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
Post a Comment