Looking up only the parent node

Here should go questions about transforming XML with XSLT and FOP.
staple
Posts: 2
Joined: Tue Aug 05, 2008 10:11 pm

Looking up only the parent node

Post by staple »

Hi, I'm working with some XML that looks something like this:

<root>
<example>
text text
<code>
text text
</code>
</example>
</root>

I am only interested in extracting the <example> text into my XSLT document. How can I go about this without also extracting the child <code>?
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Looking up only the parent node

Post by sorin_ristache »

Hello,

Use the expression /root/example/text() in your XSLT stylesheet, for example:

Code: Select all

  <xsl:apply-templates select="/root/example/text()"/>
Regards,
Sorin
staple
Posts: 2
Joined: Tue Aug 05, 2008 10:11 pm

Re: Looking up only the parent node

Post by staple »

Thank you. Works great!
Post Reply