[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Determining the context node

Subject: Re: Determining the context node
From: Evan Lenz <evan@xxxxxxxxxxxx>
Date: Fri, 14 Apr 2006 00:23:14 -0700
Re:  Determining the context node
Allison Bloodworth wrote:
Hi Evan & everyone,

Thanks very much for your help--the context node has often confused me and
this message from Evan is the most helpful information on it I've ever
gotten (especially the part about for-each and apply-templates being the
only things that change it). <xsl:value-of select="name()"/> is exactly what
I was looking for.
Great! I'm glad it was helpful.

Re: xsl:copy, since I didn't know how to get the name of the node, I was
trying to print out the content of the node using either xsl:copy or
xsl:copy-of. I would think the only real way you could do this is to use
xsl:copy...with xsl:copy-of if the current node had no text content (and
perhaps contained other elements), you would get the text content of all the
element(s) below it so you couldn't really tell what node you were on if you
were in a deep tree structure. The problem with xsl:copy, however, was that
if you were on a node with no text content itself (e.g. the node only
contained other elements) you would get nothing.
For all node types except for elements, <xsl:copy/> behaves exactly the same as <xsl:copy-of select="."/>

<xsl:copy> differs from <xsl:copy-of select="."> only when the current node is an element. The purpose of <xsl:copy> is to create a shallow copy of the element (just the start and end tags, if you will). The content of the element in the result depends on the content of <xsl:copy> in the stylesheet.

If the current node is an element, <xsl:copy> won't ever give you "nothing". At minimum, it will give you an empty element. I suspect you're only interested in seeing the text content, and perhaps because you're viewing the result in a browser?

Evan

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.