[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Re: xsl:namespace
> Can you please clarify on how to eliminate xsl:namespace in the example I've > provided? If we take your code and expand it into a full example, it could look like this: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xsl:output indent="yes"/> <xsl:template name="start"> <xsl:variable name="value" as="xs:QName" select="QName('http://www.xmlplease.com', 'jt:YES')"/> <element value="{$value}"> <xsl:namespace name="{prefix-from-QName($value)}" select="namespace-uri-from-QName($value)"/> </element> </xsl:template> </xsl:stylesheet> It works nicely but it is easy to do without xsl:namespace: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xsl:output indent="yes"/> <xsl:template name="start"> <xsl:variable name="value" as="xs:QName" select="QName('http://www.xmlplease.com', 'jt:YES')"/> <element value="{$value}" xmlns:jt="http://www.xmlplease.com"/> </xsl:template> </xsl:stylesheet> Or even this: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jt="http://www.xmlplease.com"> <xsl:output indent="yes"/> <xsl:template name="start"> <xsl:variable name="value" as="xs:QName" select="QName('http://www.xmlplease.com', 'jt:YES')"/> <element value="{$value}"/> </xsl:template> </xsl:stylesheet> It is for that reason that the examples of Vladimir, Florent, MK and the spec are not as good as they can be. They are not a raison d'C*tre for a new xsl:namespace element in XSLT 2.0. I have provided two examples where xsl:namespace is necessary. Cheers, Jesper Tverskov http://www.xmlkurser.dk http://www.xmlplease.com
|
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
|