[xsl] Getting the text node

Subject: [xsl] Getting the text node
From: aaron apigo <aaronjose_apigo2001@xxxxxxxxx>
Date: Wed, 12 Oct 2005 13:51:27 -0700 (PDT)
Hi all,
  I have a beginners question regarding capturing of
text node and tags within it, with this example:

<root>
<p>
<span>
<field>Data1</field>
</span>Some bold <b>text here</b>.
</p>
<p>
<span>
<field>Data2</field>
</span>Sample data that needs to appear <b>bold</b>
and <it>ital</it>.
</p>
</root>

output:

<Data1>Some bold <bold>text here</bold>.</Data1>
<Data2>Sample data that needs to appear
<bold>bold</bold> and <ital>ital</ital>.</Data2>

here is XSL:

<xsl:template match="p">
        <xsl:apply-templates select="span"/>
</xsl:template>

<xsl:template match="span">
 <xsl:element name="{field/text()}">
    <xsl:value-of select="following::text()[1]"/>
 </xsl:element>
</xsl:template>
    

with this simple template, i can't capture the output
that i want, i know that i should use
<xsl:apply-templates> instead of <xsl:value-of> in
getting the text nodes and the nodes within it, i was
unsuccessful. any help on this.

regards.
aaron



		
__________________________________ 
Start your day with Yahoo! - Make it your home page! 
http://www.yahoo.com/r/hs

Current Thread