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

RE: Shallow copy and base URI

Subject: RE: Shallow copy and base URI
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 26 Jan 2006 23:57:43 -0000
xsl copy xml base
The statement

if the copied node is subsequently attached as a child to a new element, the
final copy of the node inherits its base URI from its parent node

is true but incomplete. Item 10 in 5.7.1 makes clear that the same thing
applies when it's attached to a document node. I've raised the comment to
get the spec clarified.

http://www.w3.org/Bugs/Public/show_bug.cgi?id=2773

Michael Kay

> -----Original Message-----
> From: Florent Georges [mailto:darkman_spam@xxxxxxxx]
> Sent: 26 January 2006 22:51
> To: XSL Mulberry list
> Subject:  Shallow copy and base URI
>
>   Hi
>
>   I have a little question about identity copy and base URI.
> I have a module for the first pass of my pocessing, that
> uses identity copy (and remove some elements).  That
> intermediate result is put in a variable:
>
>     <xsl:variable name="tree">
>       <xsl:apply-templates mode="the.mode"/>
>     </xsl:variable>
>
>   The children of the document node are elements created by
> xsl:copy.  The source document and the stylesheets are in
> different directories.  The source tree (and thus the $tree
> document node) can have descendants whose the @href is a
> possibly relative URI that have to be used by fn:doc().
>
>   But XSLT2/'11.9.1 says:
>
>     The base URI of a node is copied. However, if the copied
>     node is subsequently attached as a child to a new
>     element, the final copy of the node inherits its base
>     URI from its parent node, unless this is overridden
>     using an xml:base attribute.
>
>   Is "to a new element" including document nodes?  It is not
> clear to me (I'd say no), but is what I observe with Saxon.
> So without explicitely set the base URI, the base URI become
> the one of the xsl:variable element.
>
>   So how to set the base URI correctly?  I can't do the
> following, because in the first one can't create an
> attribute as child of a document node and in the second one
> the xml:base value is not a correct URI:
>
>     <xsl:variable name="tree">
>       <xsl:attribute name="xml:base" select="base-uri()"/>
>       <xsl:apply-templates mode="the.mode"/>
>     </xsl:variable>
>
>     <xsl:variable name="tree">
>       <tree xml:base="{base-uri()}">
>         <xsl:apply-templates mode="the.mode"/>
>       </tree>
>     </xsl:variable>
>
>   So the only way to achive my goal is to use the following:
>
>     <xsl:variable name="tree">
>       <tree>
>         <xsl:attribute name="xml:base" select="base-uri()"/>
>         <xsl:apply-templates mode="the.mode"/>
>       </tree>
>     </xsl:variable>
>
>   Or to have exactly the same result as expected at the
> beginning, I have to use a temporary variable (to avoid to
> create a document node):
>
>     <xsl:variable name="tmp.tree">
>       <tree>
>         <xsl:attribute name="xml:base" select="base-uri()"/>
>         <xsl:apply-templates mode="the.mode"/>
>       </tree>
>     </xsl:variable>
>
>     <xsl:variable name="tree" select="$tmp.tree/tree/*"/>
>
>   Is all this right?  Are document nodes concerned by the
> paragraph cited above?  Is there a simpler way to achieve
> the original goal?
>
>   Thanks.  Regards,
>
> --drkm
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ______________________________________________________________
> _____________
> Nouveau : tiliphonez moins cher avec Yahoo! Messenger !
> Dicouvez les tarifs exceptionnels pour appeler la France et
> l'international.
> Tilichargez sur http://fr.messenger.yahoo.com

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.