Register  Login       Search  
Forum  
 
  
 
Forum  Forum     
 
SearchForum Home
  XML  Employing XML in .NET  Transformation ...
 Transformation of & does not work correct in the Multi Output mode (-mo)
 
pie
2 posts
Joined
11/23/2005

Transformation of & does not work correct in the Multi Output mode (-mo)
Posted: 23 Nov 05 8:22 AM (Switzerland)
Hy I have the problem with the Multi output (-mo)
I generate hunderts of XML Files with the exslt:document funktionality
the problem are mapping of text that contain & character.
 
I realised that the mapping of & works fine when i run in NOT Multi output.
When I switch to Multi Output mode the & is allways transformated in a &
This should not happen because I exape that part via a CDATA construction
 
Example:

This XML
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="charrefstest.xslt"?>
<Body><![CDATA[Text Part 1 &#x0D;&#x0A; Text Part 2]]></Body>

This XSLT:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
     <xsl:template match="/">     
          <xsl:value-of disable-output-escaping="yes" select="Body"/>
     </xsl:template>
</xsl:stylesheet>

Produces this output in NOT Mulit Output:
<?xml version="1.0" encoding="UTF-8"?>Text Part 1 &#x0D;&#x0A; Text Part 2
 
With Multi Output option (-mo):
<?xml version="1.0" encoding="UTF-8"?>Text Part 1 &amp;#x0D;&amp;#x0A; Text Part 2
 
And that is not that what I want.
As I see it, I think we have here a BUG in the Processor. Isn't it?
What about a BUG fix?
 
olegt
85 posts
www.xmllab.net
Joined
2/25/2005

Re: Transformation of & does not work correct in the Multi Output mode (-mo)
Posted: 01 Dec 05 12:58 PM (Israel)

That's not a bug, but a known limitation, documented at http://mvp-xml.sourceforge.net/exslt/.

You see, the problem is that multioutput is implemented by postprocessig XSLT output by custom XmlWriter - MultiXmlTextWriter and .NET always inores disable-output-escaping when transforming to an XmlWriter.

And there is no easy workaround unfortunately.

What I can do is add a feature for mapping output characters like in XSLT2 (see http://www.w3.org/TR/2005/CR-xslt20-20051103/#element-output-character), say you can run

nxslt.exe ...  ... -map "§" "&"

then in XSLT stylesheet you use § instead of & and at output it gets replaced by &.

What do you think? Ideas?


Oleg Tkachenko, Microsoft MVP for XML, MCPD
http://www.XmlLab.Net | http://blog.tkachenko.com
pie
2 posts
Joined
11/23/2005

Re: Transformation of & does not work correct in the Multi Output mode (-mo)
Posted: 20 Dec 05 1:19 AM (Switzerland) Modified By pie  on 12/20/2005 1:22:27 AM)

First: Sorry that I didn't replay imitate ...

Your proposal off adding an output character mapping sounds good and I think that would work for my problem.

So, can you do it?

 

 

olegt
85 posts
www.xmllab.net
Joined
2/25/2005

Re: Transformation of & does not work correct in the Multi Output mode (-mo)
Posted: 20 Dec 05 1:52 AM (Israel)
Already working on it...
Oleg Tkachenko, Microsoft MVP for XML, MCPD
http://www.XmlLab.Net | http://blog.tkachenko.com
  XML  Employing XML in .NET  Transformation ...
Forum Home  Search