Register  Login       Search  
Forum  
 
  
 
Forum  Forum     
 
SearchForum Home
  XML Lab Products  nxslt  xsl:output...
 xsl:output
 
sergey_shandar
8 posts
Joined
9/11/2005

xsl:output
Posted: 26 Oct 05 6:33 PM (Australia)
Hi, Oleg.

I have an XSLT file (a.xsl) that defines output as <xsl:output method="xml" doctype-public="a" doctype-system="b"/>. Then I want to use this file as an imported stylesheet but the output method should be just xml without <!DOCTYPE>. So I've tried

...
<xsl:import href="a.xsl"/>
<xsl:output method="xml"/>
...

but the output file still contains <!DOCTYPE>.

Any idea how to fix it?
olegt
85 posts
www.xmllab.net
Joined
2/25/2005

Re: xsl:output
Posted: 30 Oct 05 1:15 PM (Israel)

Hmmm, that's a tough question. XSLT doesn't provide a way to supress xsl:output, you can only override them.

I see a couple solutions:

1. Transform imported stylesheet to filter out doctype-public/doctype-system attributes of xsl:output before applying it. XSLT is just XML so it's easy. A drawback is a temporary file.

2. Trick - when using -mo option xsl:output instructions are currently just ignored (along with disable-output-escaping). It's pretty safe from XSLT processing point of view, but I can't guarantee I won't change it in future nxslt versions. .NET 2.0 actually allows me to fix this deficiency.


Oleg Tkachenko, Microsoft MVP for XML, MCPD
http://www.XmlLab.Net | http://blog.tkachenko.com
sergey_shandar
8 posts
Joined
9/11/2005

Re: xsl:output
Posted: 30 Oct 05 8:36 PM (Australia)
I don't like really any tricks with -mo option. Also, I've had discussion with 4xslt developers. They've sad <xsl:output> is addative, so the behaviour is right, but if you set doctype-public="" and doctype-system="" then output won't containt <!DOCTYPE>. I like the idea.

Since .NET 2.0 was released, I don't care any more about .NET 1.1. But I've never tried to use NXSLT 2. Sure I will.
olegt
85 posts
www.xmllab.net
Joined
2/25/2005

Re: xsl:output
Posted: 31 Oct 05 5:33 AM (Israel)

Well, unfortunately nothing in XSLT spec says that doctype-system="" means no Doctype, so most XSLT processors just produce <!DOCTYPE foo PUBLIC "" ""> in this case. And .NET 2.0 too.

For nxslt v1.X I can extend my filtering reader (that takes care of extension-element-prefixes) to filter out doctype-system/doctype-public attributes if some command line option is specified. That sounds easy. But for nxslt2 must be a better solution.

 


Oleg Tkachenko, Microsoft MVP for XML, MCPD
http://www.XmlLab.Net | http://blog.tkachenko.com
  XML Lab Products  nxslt  xsl:output...
Forum Home  Search