XSLT for-each, iterating through text and nodes -


i'm still learning xslt, , have question for-each loop.

here's have far xml

<body>here great url<link>http://www.somesite.com</link>some more text</body> 

what i'd if for-each loop iterate through these chunks 1. here great url 2. http://www.somesite.com 3. more text

this might simple, or impossible, if can me out i'd appreciate it!

thanks, michael

you should able following:

<xsl:for-each select=".//text()">   <!-- . have value of each chunk of text. -->   <sometext>     <xsl:value-of select="." />   </sometext> </xsl:for-each> 

or may preferable because allows have single template can invoke multiple different places:

<xsl:apply-templates select=".//text()" mode="processtext" /> <xsl:template match="text()" mode="processtext">   <!-- . have value of each chunk of text. -->   <sometext>     <xsl:value-of select="." />   </sometext> </xsl:for-each> 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -