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

RE: Embedding html within xml

Subject: RE: Embedding html within xml
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 11 Mar 2004 15:03:27 -0500
xsl copy of select self
At 02:08 PM 3/11/2004, it was written:
Hmm... What doesn't work? In the code below you should be able to just change the
<xsl:value-of select="."/> to <xsl:copy-of select="./node()"/>

And ... today's little XPath lesson...:


[0] "." is short for "self::node()"

[1a] select="node()" is short for select="child::node()"
     (select all child nodes of the context node)

[1b] select="./node()" is short for select="self::node()/child::node()"
     (select all child nodes of the context node itself)

These are functionally equivalent, which makes this case very different from another apparently similar pairing:

[2a] select="//node()" is short for
     select="/descendant-or-self::node()/child::node()"

[2b] select=".//node()" is short for
     select="self::node()/descendant-or-self::node()/child::node()"

That is, [2a] is the same as "/descendant::node()" (node descendants of the root), while [2b] is the same as "self::node()/descendant::node()" (node descendants of the context node) -- not the same thing at all.

Back to the thread ... if you want to copy the current node (with all descendants), not just its children (with theirs), that's

<xsl:copy-of select="."/> (expands as in [0])

... or perhaps you really want to copy the node's children (with all descendants) but not the node itself: you can do this with copy-of select="node()" [1a].

I say "with all descendants" because that's what copy-of does. For the OP, that's how the <a> node in the source gets included when its parent's template says to copy node children.

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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.