Page 1 of 1

Looking up only the parent node

Posted: Tue Aug 05, 2008 10:15 pm
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>?

Re: Looking up only the parent node

Posted: Wed Aug 06, 2008 10:45 am
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

Re: Looking up only the parent node

Posted: Thu Aug 07, 2008 7:51 pm
by staple
Thank you. Works great!