xsl-list
[Top] [All Lists]

Getting the text node

2005-10-12 13:51:27

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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>