[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Re: xsl:namespace
Subject: Re: [xsl] Re: xsl:namespace From: Jesper Tverskov <jesper.tverskov@xxxxxxxxx> Date: Fri, 20 Feb 2009 20:36:42 +0100 |
> 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: xsl:namespace, Vladimir Nesterovsky | Thread | [xsl] Re: xsl:namespace, Vladimir Nesterovsky |
[xsl] Re: xsl:namespace, Vladimir Nesterovsky | Date | Re: [xsl] variable ending with ^@, C. M. Sperberg-McQue |
Month |
Keywords