- From: Laurens Holst <lholst@students.cs.uu.nl>
- Date: Thu, 29 Jun 2006 03:40:00 +0200
- To: Ian Davis <iand@internetalchemy.org>
- Cc: mark.birbeck@x-port.net, public-rdf-in-xhtml-tf@w3.org
- Message-ID: <44A32F70.3050402@students.cs.uu.nl>
The XSLT 2.0 specification actually makes several explicit statements about namespace prefixes. Section 5.7.3: The actual namespace nodes that are added to the tree by the namespace fixup process are implementation-dependent <http://www.w3.org/TR/xslt20/#dt-implementation-dependent>, provided firstly, that at the end of the process the above constraints must all be satisfied, and secondly, that a namespace node must not be added to the tree unless the namespace node is necessary either to satisfy these constraints, or to enable the tree to be serialized using the original namespace prefixes from the source document or stylesheet <http://www.w3.org/TR/xslt20/#dt-stylesheet>. and: Namespace fixup may, if necessary to resolve conflicts, change the namespace prefix contained in the QName value that holds the name of an element or attribute node. However, namespace fixup must not change the prefix component contained in a value of type |xs:QName| or |xs:NOTATION| that forms the typed value of an element or attribute node. And I could probably quote more. So, there *are* mechanisms in place to ensure this as much as possible, at least in XSLT 2.0. I don’t know whether this was already as explicit in XSLT 1.0, but the existing implementations seem to suggest so. ~Grauw Ian Davis schreef: > > Mark, > > Thanks for the detailed reply. If I'm understanding correctly, I take > your position to be something like: "using xslt with qnames in content > is safe unless you are deliberately removing namespace nodes". Am I > correct? > > The evidence you cite is that "XSLT is used in hundreds of thousands > of applications every day, to process documents that contain QNames in > their attributes." > > I don't dispute the fact that we all use a lot of XSLT. But I don't > believe that qname in content safety is anywhere specified in the XSLT > recommendation and, as I pointed out, it is explicitly stated that > prefixes may be changed by processors. The reason few errors are > encountered are primarily through the use of conventions for namespace > prefixes such as foaf, cc, xsl, xs, etc. > > An application is, of course, free to choose any namespace prefix it > desires. Try, for example applying this stylesheet to the xml that > follows: > > > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:x="http://www.w3.org/1999/xhtml" > xmlns:a="http://example.com/bar#" > > > <xsl:template match="*"> > <xsl:copy> > <xsl:copy-of select="@*" /> > <xsl:copy-of select="namespace::*" /> > <xsl:apply-templates select="*"/> > </xsl:copy> > </xsl:template> > > <xsl:template match="x:p"> > <x:p a:ex="test"> > <xsl:copy-of select="@*" /> > <xsl:copy-of select="namespace::*" /> > <xsl:copy-of select="*"/> > </x:p> > </xsl:template> > > </xsl:stylesheet> > > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml" > xmlns:a="http://example.com/foo#" > xml:lang="en" lang="en"> > <head> > <title>Test</title> > </head> > <body > > <p property="a:annotation"> > this is an annotation > </p> > </body> > </html> > > > I find in MSXSL and in XSLTPROC that the qname in the property > attribute has changed it's binding. I'd be interested to see your > results. > > > On 17/06/2006 17:31, Mark Birbeck wrote: >> However, since the theme of this discussion is that we need to avoid >> using QNames in attributes--and invent alternatives--then it's >> obviously important to continue with the XSLT-specific discussion >> here. > > Or we can switch to SAX pipelines, or XML databases, or any system > that may parse, manipulate and then serialize an XML document. > > > > Ian -- Ushiko-san! Kimi wa doushite, Ushiko-san!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Laurens Holst, student, university of Utrecht, the Netherlands. Website: www.grauw.nl. Backbase employee; www.backbase.com.
Received on Thursday, 29 June 2006 01:40:10 UTC