[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Inconsistent interpretation of // relative to doc
As others have said, the difference is probably that the stylesheet has a different base URI in the two cases. The base URI is an implicit argument to the document() function. When using JAXP, the base URI is set when you call setSystemId() on the Source object used to construct the Templates object. When using Ant, I'm afraid I have no idea where the base URI comes from - but you can avoid problems by supplying an absolute URI as the value of the parameter, or by calling resolve-uri() to control the URI resolution yourself. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Richard Hoberman [mailto:richard.hoberman@xxxxxxxxxxxxx] > Sent: 22 August 2007 12:42 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: Inconsistent interpretation of // relative to > document() > > I get different results when using Saxon to merge two > documents, depending on whether I invoke Saxon via Ant or via JAXP. > > The difference appears to be how "//" is interpreted while > processing nodes obtained using document(). The Ant version > finds nodes in the source document (as opposed to the one > obtained via the function). The JAXP version finds nodes > among those returned by the document function. > > Which is the correct behaviour? (Also, is there a name for "//"?) > > I am using Saxon-8.9B, Sun JDK 1.6, XSLT 2. My stylesheet is below. > > Regards > > Richard Hoberman > > > <xsl:stylesheet version="2.0" > xmlns="http://www.w3.org/1999/XSL/Format" > xmlns:c="http://www.sadalbari.com/2007/FO/Composition" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > <xsl:param name="template-source" /> > > <xsl:variable name="template" > select="document($template-source)/*" /> > > <xsl:template match="c:composition"> > <xsl:apply-templates select="$template" mode="insert" /> > </xsl:template> > > <xsl:template match="c:insert" mode="insert"> > <xsl:variable name="name" select="@name" /> > <xsl:apply-templates select="//c:define[@name=$name]/node()" > mode="insert" /> > </xsl:template> > > <xsl:template match="@*|node()" mode="insert"> > <xsl:copy> > <xsl:apply-templates select="@*|node()" mode="insert" /> > </xsl:copy> > </xsl:template> > > <xsl:template match="@*|node()" mode="copy"> > <xsl:copy> > <xsl:apply-templates select="@*|node()" mode="copy" /> > </xsl:copy> > </xsl:template> > > <xsl:template match="*" /> > > </xsl:stylesheet>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|