Subject: Re: [xsl] default or no namespace From: ac <ac@xxxxxxxxxxxxx> Date: Wed, 29 Dec 2010 13:44:12 -0500 |
Regards, ac
On 28 December 2010 14:59, ac<ac@xxxxxxxxxxxxx> wrote:Hi Andrew, All,...
Interesting. I think that I need a little more though.
Does it mean that I should do something like:
<xsl:variable name="page"> <html> ... </html> </xsl:variable> <xsl:choose> <xsl:when test="$cond"> <xsl:apply-templates mode="put-in-xhtml-ns" select="$page"/> </xsl:when> <xsl:otherwise> <xsl:copy-of select=$page"/> </xsl:otherwise> </xsl:choose><xsl:template mode="put-in-xhtml-ns" match="*"> <xsl:element name="{QName('http://www.w3.org/1999/xhtml', local-name(.))}"> <xsl:copy-of select="@*"/> <xsl:apply-templates mode="#current"/> </xsl:copy> </xsl:template>Yes that's pretty much it. Instead of the QName constructor, you could've used the namespace attribute on xsl:element. (also im assuming the missing closing</xsl:element> is a typo)
It's up to you, I prefer the moded approach.Why not something simpler as just <xsl:element name=" {QName(if ($cond) then 'http://www.w3.org/1999/xhtml' else '', 'html')}"> ... </xsl:element>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] default or no namespace, Andrew Welch | Thread | Re: [xsl] default or no namespace, Piet van Oostrum |
Re: [xsl] Avoiding boneheaded mista, Dave Pawson | Date | Re: [xsl] Avoiding boneheaded mista, Andrew Welch |
Month |