- From: Richard Tobin <richard@cogsci.ed.ac.uk>
- Date: Tue, 27 Mar 2001 15:16:52 +0100 (BST)
- To: "Michael Rys" <mrys@microsoft.com>, "Richard Tobin" <richard@cogsci.ed.ac.uk>, <www-xml-infoset-comments@w3.org>
- Cc: <pgrosso@arbortext.com>, <lehors@us.ibm.com>, "Paul Cotton" <pcotton@microsoft.com>, "Jonathan Marsh" <jmarsh@microsoft.com>, "W3C XML Query WG (E-mail) (E-mail)" <w3c-xml-query-wg@w3.org>
> I am not convinced.
Clearly I am not explaining this well. Let me try again.
The XML Infoset model for namespaces it the same as XPath's. There is
a one-to-one correspondence between Infoset Namespace infoitems and
XPath Namespace nodes.
Compare XPath:
Each element has an associated set of namespace nodes, one for each
distinct namespace prefix that is in scope for the element [...]
with Infoset:
There is one namespace information item for each namespace in scope
for each element in the document.
The cut-and-paste motivation that I gave is exactly what XSLT does.
For example:
instance:
<foo>
<a:A xmlns:a="http://example.org/a">
<b:B xmlns:b="http://example.org/b">contents of B</b:B>
</a:A>
<c:C xmlns:c="http://example.org/c"/>
</foo>
stylesheet:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:b="http://example.org/b"
xmlns:c="http://example.org/c">
<xsl:template match="/">
<xsl:apply-templates select="foo/c:C"/>
</xsl:template>
<xsl:template match="c:C">
<xsl:copy>
<xsl:apply-templates select="//b:B"/>
</xsl:copy>
</xsl:template>
<xsl:template match="b:B">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
This example copies the c:C element and copies the b:B element into
it. The result (from XT, reformatted) is:
<?xml version="1.0" encoding="utf-8"?>
<c:C xmlns:c="http://example.org/c">
<b:B xmlns:a="http://example.org/a"
xmlns:b="http://example.org/b">contents of B</b:B>
</c:C>
Observe that the "a" namespace binding was copied along with the b:B
element.
-- Richard
Received on Tuesday, 27 March 2001 09:17:01 UTC