Re: XSL Newbie but a really annoying problem
- From: Martin Honnen <mahotrash@xxxxxxxx>
- Date: Tue, 29 Jan 2008 13:18:34 +0100
danmat46@xxxxxxxxxxxxxx wrote:
Morning all,
Just started out with XSL.
Now working on my first example I have the following XML structure
<topLevel>
<repeatLevel name="hello" type="hello">
<![CDATA[sometext in here]]>
</repeatLevel>
<repeatLevel name="hello2" type="hello2">
<![CDATA[more text in here]]>
</repeatLevel>
</topLevel>
Now developing the XSL is going fine, I have an html table with three
columns and been able to output the name and type but I cannot get the
CDATA's text in the third column.
Is this possible?
Sure, why not? In the XSLT/XPath data model there are no CDATA sections anyway, the repeatLevel elements simply have a string value so you can do e.g.
<xsl:template match="repeatLevel">
<tr>
<td><xsl:value-of select="@name"/></td>
<td><xsl:value-of select="@type"/></td>
<td><xsl:value-of select="."/></td>
</tr>
</xsl:template>
Or with additonal templates you do e.g.
<xsl:template match="repeatLevel">
<tr>
<xsl:apply-templates select="@* | node()"/>
</tr>
</xsl:template>
<xsl:template match="repeatLevel/@* | repeatLevel/text()">
<td>
<xsl:value-of select="."/>
</td>
</xsl:template>
--
Martin Honnen
http://JavaScript.FAQTs.com/
.
- References:
- XSL Newbie but a really annoying problem
- From: danmat46
- XSL Newbie but a really annoying problem
- Prev by Date: Re: how to Update/insert an xml element's text----> (<element> text</element>)
- Next by Date: Re: how to Update/insert an xml element's text----> (<element> text</element>)
- Previous by thread: Re: XSL Newbie but a really annoying problem
- Index(es):
Relevant Pages
|