XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Max MandersSubject: Handle elements within text nodes?!
Author: Max Manders
Date: 04 Jul 2007 09:09 AM
I have some xml, e.g.

<SomeText>
Lorem <red>ipsum</red> dolor <red>sit</red>.
</SomeText>

I want to output that text, i.e.
<xsl:value-of select="SomeText" />

However, when an element within SomeText that is wrapped by <red></red> is encountered, I wasnt to wrap that word with <fo:inline color="red></fo:inline>.

How would I achieve this, i.e. how can I add extra processing to items within the text node, but output the text in order?

Posttop
James DurningSubject: Handle elements within text nodes?!
Author: James Durning
Date: 04 Jul 2007 10:35 AM
use <xsl:apply-templates select="SomeText"/>

<xsl:template match="red">
<fo:inline color="red>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>

Using apply-templates will cause the text to be in order. The text in SomeText will be automatically output, while the rest will fall to the 'red' template.

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.