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

Re: Copying a document except specific root attribute

Subject: Re: Copying a document except specific root attribute
From: Jon Gorman <jonathan.gorman@xxxxxxxxx>
Date: Mon, 13 Jun 2005 10:24:57 -0500
root attribute
> For starters, I use the identity transformation to copy all elements and
> attributes of an XML document. Additionally, I have a rule like:
>
> <xsl:template match="/@myRootAttribute"/>

Of course it's ignoring that attribute.  It can't exist ;).  /
designates document root, the parent of the document element.

See XPATH 1.0: "/ selects the document root (which is always the
parent of the document element)"

So say your xml looks like:
<root>
  <foo> ... </foo>
  <bar> ... </bar>
</root>

What you are asking for is equivalent to saying, I want the
@myRootAttribute of the parent of root.

What I think you mean to say is:

<xsl:template match="/root/@myRootAttribute"/>

which would match the attribute below in the root element.

<root @myRootAttribute="spiffy">
   <foo>...</foo>
</root>

Of course, this more involved if by the root attribute you actually
mean the namespace that is declared there.  Is this the case?

Jonathan Gorman

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.