unknown
1970-01-01 00:00:00 UTC
If we're talking about XQuery 1.0, then yes, I believe that there is no way you can create an element with a namespace that is (a) unused on that element, and (b) not known statically.
(I might be wrong; I seem to recall David Carlisle coming up with a devious workaround, but it was so devious I don't recall how it works).
Query 3.0 introduces dynamic namespace node constructors to solve this problem. This leaves the language in the rather absurd situation that there is a construct to create namespace nodes, but no construct to retrieve them.
The XQuery WG was very reluctant to support the namespace axis because many vendors claimed that it was impossible to support it efficiently. Some of those vendors, when told to look at open source implementations like xt and Saxon that had efficient implementations, said that their company policy did not allow them to read open source code. Shame.
Michael Kay
Saxonica
(I might be wrong; I seem to recall David Carlisle coming up with a devious workaround, but it was so devious I don't recall how it works).
Query 3.0 introduces dynamic namespace node constructors to solve this problem. This leaves the language in the rather absurd situation that there is a construct to create namespace nodes, but no construct to retrieve them.
The XQuery WG was very reluctant to support the namespace axis because many vendors claimed that it was impossible to support it efficiently. Some of those vendors, when told to look at open source implementations like xt and Saxon that had efficient implementations, said that their company policy did not allow them to read open source code. Shame.
Michael Kay
Saxonica
$ java -jar ~/Desktop/saxon6-5-5/saxon.jar dummy.xml compel.xsl ; echo
<a xmlns:pre="urn:u"><pre:b/><pre:c/></a>
$
$ cat compel.xsl
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exslt = "http://exslt.org/common"
<xsl:output omit-xml-declaration="yes" />
<xsl:template match="/">
<xsl:variable name="tmp">
<xsl:element name="a">
<xsl:attribute name="pre:Êɯɯnp" xmlns:pre="urn:u"/>
<xsl:element name="pre:b" xmlns:pre="urn:u"/>
<xsl:element name="pre:c" xmlns:pre="urn:u"/>
</xsl:element>
</xsl:variable>
<xsl:apply-templates select="exslt:node-set($tmp)/*"/>
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="namespace::*|attribute::*[local-name
()!='Êɯɯnp']"/>
<xsl:apply-templates select="*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
$
(1) http://www.w3.org/TR/xpath20/#dt-in-scope-namespaces
(2) http://www.w3.org/TR/xquery/#id-computedElements
Mit besten Gruessen / Best wishes,
Hermann Stamm-Wilbrandt
Level 3 support for XML Compiler team and Fixpack team lead
WebSphere DataPower SOA Appliances
https://www.ibm.com/developerworks/mydeveloperworks/blogs/HermannSW/
https://twitter.com/HermannSW/
http://stamm-wilbrandt.de/GraphvizFiddle/
----------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
_______________________________________________
http://x-query.com/mailman/listinfo/talk
<a xmlns:pre="urn:u"><pre:b/><pre:c/></a>
$
$ cat compel.xsl
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exslt = "http://exslt.org/common"
<xsl:output omit-xml-declaration="yes" />
<xsl:template match="/">
<xsl:variable name="tmp">
<xsl:element name="a">
<xsl:attribute name="pre:Êɯɯnp" xmlns:pre="urn:u"/>
<xsl:element name="pre:b" xmlns:pre="urn:u"/>
<xsl:element name="pre:c" xmlns:pre="urn:u"/>
</xsl:element>
</xsl:variable>
<xsl:apply-templates select="exslt:node-set($tmp)/*"/>
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="namespace::*|attribute::*[local-name
()!='Êɯɯnp']"/>
<xsl:apply-templates select="*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
$
(1) http://www.w3.org/TR/xpath20/#dt-in-scope-namespaces
(2) http://www.w3.org/TR/xquery/#id-computedElements
Mit besten Gruessen / Best wishes,
Hermann Stamm-Wilbrandt
Level 3 support for XML Compiler team and Fixpack team lead
WebSphere DataPower SOA Appliances
https://www.ibm.com/developerworks/mydeveloperworks/blogs/HermannSW/
https://twitter.com/HermannSW/
http://stamm-wilbrandt.de/GraphvizFiddle/
----------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
_______________________________________________
http://x-query.com/mailman/listinfo/talk