[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[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 &#x3B8;</this>
   <that>A non math character &#0931;</that>
   <that>A non math character &#x2248;</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}}|(&#0931;)">
<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 &#952;</this>
<that>A non math character <span xmlns="http://www.w3.org/1999/xhtml" class="Symbol">&#931;</span>
</that>
<that>A non math character <span xmlns="http://www.w3.org/1999/xhtml" class="Symbol">&#8776;</span>
</that>
</DD>
--------------------------------------------


____  What I wish   anotherOutputFile.xml   looked like _________
<?xml version="1.0" encoding="iso-8859-1"?>
<DD>
     <this>The Theta character &#952;</this>
     <that>A non math character <span>&#931;</span>
  </that>
     <that>A non math character <span>&#8776;</span>
  </that>
</DD>
--------------------------------------------


Current Thread
Keywords