Subject: Re: [xsl] Inconsistency between XPath 1.0 and XSLT 1.0 treatment of processing instruction initial whitespace From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 20 Jul 2004 14:39:50 +0100 |
[I killed xsl-list as you're not supposed to cc this list and another (and I got ticked off by our esteemed list owner last time I tried:-) ] > In other words, the xsl:processing-instruction element appears able to > create processing instructions that are not legal in the XPath 1.0 data > model. I don't think that's necessarily a problem for 1.0, it just means that <xsl:processing-instruction name="testcase"> This is the content of a PI </xsl:processing-instruction> generates <?testcase This is the content of a PI ?> which if re-parsed produces some input equvalent to <?testcase This is the content of a PI ?> At no point is an inconsistent set of data produced, as XSLT 1 (unextended) can't query into the result tree fragment generated by the xsl:processing-instruction. However for xsl2 2... <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:template match="/"> <xsl:variable name="x"> <xsl:processing-instruction name="testcase"> This is the content of a PI </xsl:processing-instruction> </xsl:variable> [[<xsl:value-of select="$x//processing-instruction()"/>]] </xsl:template> </xsl:stylesheet> $ saxon8 pi.xsl pi.xsl <?xml version="1.0" encoding="UTF-8"?> [[ This is the content of a PI ]] so it's generated a PI with leading white space, which again can't come from parsing an XML file, but it doesn't seem to break any of the constraints in: http://www.w3.org/TR/xpath-datamodel/#ProcessingInstructionNode (as there are no constraints:-) so even here, this seems to be OK, I think, although it's not common in xslt to be able to generate a result tree that can't be generated by parsing an xml file. The alternative I suppose would be for xsl:proccing-instruction to strip any leading white space from its supplied content. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Inconsistency between XPath 1, Elliotte Harold | Thread | [xsl] Can´t escape, xptm |
[xsl] Inconsistency between XPath 1, Elliotte Harold | Date | [xsl] Can´t escape, xptm |
Month |