Subject: [xsl] asthetics vs convention for namespace prefixs From: "James A. Robinson" <jim.robinson@xxxxxxxxxxxx> Date: Thu, 26 Jul 2007 06:20:12 -0700 |
I'm working on an application where I'd like, for asthetic reasons, to force the use of a particular xmlns prefix when dealing with a particular tree of content. Since, in this situation, I'm in complete control of what data is being generated and copied, I played around with trying to encourage the XSLT processor (Saxon in this case) to use a specific namespace prefix: <!-- Convert non-namespaced elements to the xyz namespace. --> <xsl:template mode="xyz:clone-to-namespace" match="@*|node()"> <xsl:choose> <xsl:when test="self::element() and not(namespace-uri(.))"> <xsl:element name="xyz:{local-name(.)}" namespace="http://schema.example.org/XYZ/Publishing" xmlns:xyz="http://schema.example.org/XYZ/Publishing"> <xsl:copy-of select="@*" /> <xsl:apply-templates mode="#current" /> </xsl:element> </xsl:when> <xsl:otherwise> <xsl:copy> <xsl:copy-of select="@*" /> <xsl:apply-templates mode="#current" /> </xsl:copy> </xsl:otherwise> </xsl:choose> </xsl:template> I know I can't rely on the prefix being used, but is it frowned upon to try and encourage a specific namespace prefix? Jim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - James A. Robinson jim.robinson@xxxxxxxxxxxx Stanford University HighWire Press http://highwire.stanford.edu/ +1 650 7237294 (Work) +1 650 7259335 (Fax)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Rounding errors in financ, Dimitre Novatchev | Thread | Re: [xsl] asthetics vs convention f, David Carlisle |
Re: [xsl] Rounding errors in financ, David Carlisle | Date | Re: [xsl] asthetics vs convention f, David Carlisle |
Month |