[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
I asked this question before, but I didn't have a clean example ( I am liking Kernow more and more). I am wondering if there is a way to (how to) write some xslt that has two output files with different namespace declarations. My example input, xslt, and 2 output files are below.
My default output file is working correctly. It has this at the top <html "xmlns="http://www.w3.org/1999/xhtml"> see ___Default output___ below. In my real code this output file is much bigger with lots of xslt that makes it. XSLT that I hope I don't have to change.
In the second output file _anotherOutputFile.xml _,
I would like to find a way for it to not have a namespace declaration in any of the subnodes.
Can you help?
<xsl:template match="DD">
<xsl:result-document href="{'anotherOutFile.xhtml'}" format="xml" indent="yes">
<xsl:copy>
<xsl:apply-templates mode="copythat"/>
</xsl:copy>
</xsl:result-document> <html> a bunch of stuff goes here. </html>
</xsl:template>
<xsl:template match="text()" mode="copythat">
<xsl:analyze-string select="." regex="\p{{IsMathematicalOperators}}|(Σ)">
<xsl:matching-substring><span class="Symbol"><xsl:value-of select="."/></span></xsl:matching-substring>
<xsl:non-matching-substring><xsl:value-of select="."/></xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:template>
<xsl:template match="*" mode="copythat">
<xsl:copy><xsl:copy-of select="@*"/><xsl:apply-templates mode="copythat"/></xsl:copy>
</xsl:template>
____ anotherOutputFile.xml _________
<?xml version="1.0" encoding="iso-8859-1"?>
<DD>
<this>The Theta character θ</this>
<that>A non math character <span xmlns="http://www.w3.org/1999/xhtml" class="Symbol">Σ</span>
</that>
<that>A non math character <span xmlns="http://www.w3.org/1999/xhtml" class="Symbol">≈</span>
</that>
</DD>
--------------------------------------------
[xsl] another namespace question
Subject: [xsl] another namespace question From: Fred Christian <fredc@xxxxxxxxxx> Date: Wed, 14 Jan 2009 10:46:07 -0800 |
I asked this question before, but I didn't have a clean example ( I am liking Kernow more and more). I am wondering if there is a way to (how to) write some xslt that has two output files with different namespace declarations. My example input, xslt, and 2 output files are below.
My default output file is working correctly. It has this at the top <html "xmlns="http://www.w3.org/1999/xhtml"> see ___Default output___ below. In my real code this output file is much bigger with lots of xslt that makes it. XSLT that I hope I don't have to change.
In the second output file _anotherOutputFile.xml _,
I would like to find a way for it to not have a namespace declaration in any of the subnodes.
Can you help?
______ Input XML ____________________ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <DD> <this>The Theta character θ</this> <that>A non math character Σ</that> <that>A non math character ≈</that> </DD>
____________ XSLT __________________ <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="UTF-8" indent="yes" method="xml"/> <xsl:output encoding="iso-8859-1" method="xml" indent="yes" name="xml"/>
<xsl:template match="DD">
<xsl:result-document href="{'anotherOutFile.xhtml'}" format="xml" indent="yes">
<xsl:copy>
<xsl:apply-templates mode="copythat"/>
</xsl:copy>
</xsl:result-document> <html> a bunch of stuff goes here. </html>
</xsl:template>
<xsl:template match="text()" mode="copythat">
<xsl:analyze-string select="." regex="\p{{IsMathematicalOperators}}|(Σ)">
<xsl:matching-substring><span class="Symbol"><xsl:value-of select="."/></span></xsl:matching-substring>
<xsl:non-matching-substring><xsl:value-of select="."/></xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:template>
<xsl:template match="*" mode="copythat">
<xsl:copy><xsl:copy-of select="@*"/><xsl:apply-templates mode="copythat"/></xsl:copy>
</xsl:template>
</xsl:stylesheet> --------------------------------------------
_______ Default output ______________ <?xml version="1.0" encoding="UTF-8"?> <html xmlns="http://www.w3.org/1999/xhtml"> <body>a bunch of stuff <i>goes here</i>.</body> </html> --------------------------------------------
____ anotherOutputFile.xml _________
<?xml version="1.0" encoding="iso-8859-1"?>
<DD>
<this>The Theta character θ</this>
<that>A non math character <span xmlns="http://www.w3.org/1999/xhtml" class="Symbol">Σ</span>
</that>
<that>A non math character <span xmlns="http://www.w3.org/1999/xhtml" class="Symbol">≈</span>
</that>
</DD>
--------------------------------------------
____ What I wish anotherOutputFile.xml looked like _________ <?xml version="1.0" encoding="iso-8859-1"?> <DD> <this>The Theta character θ</this> <that>A non math character <span>Σ</span> </that> <that>A non math character <span>≈</span> </that> </DD> --------------------------------------------
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Using XSLT as a namespace, Nathan Potter | Thread | Re: [xsl] another namespace questio, Fred Christian |
Re: [xsl] Using XSLT as a namespace, Nathan Potter | Date | Re: [xsl] another namespace questio, Fred Christian |
Month |