You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Sree P.N. Sreeram" <ps...@cas.org> on 2000/10/30 17:09:50 UTC

xsl:output bug

Hello

I'm facing another problem with xalan.

System details:

SUN Solaris 2.6 using J2SE 1.2.2
xalan-j_1_2

I pass a parameter for setting the DTD file in my output.
Here's the code snippet from my xsl file.

<!-- Get the name of the DTD file that was passed -->
<xsl:param name="dtdFile" select="'default value'"/>

<xsl:output method="xml" indent="no"
doctype-system="$dtdFile"/>

Now, after processing, the output xml file does not replace
$dtdFile with the string passed. It just retains it as
$dtdFile (<!DOCTYPE blah SYSTEM "$dtdFile"> instead of
<!DOCTYPE blah SYSTEM "blah.dtd">)

Is this a bug in xalan-j_1_2? Is there a way around this?

Thanks
Sree

Re: xsl:output bug

Posted by "Sree P.N. Sreeram" <ps...@cas.org>.
Gary,

Gary L Peskin wrote:

> The code for the evaluate function was sent to the list a while back.
> Let me know if you need me to resend it.

Sorry, I'm new to this list. Could you please it to me?
Thanks.

> Unfortunately, neither (1) nor (2) is very clean.  (1) allows you to get
> away with using only standard XSLT but it treats the !DOCTYPE as text
> rather than in the proper way as with xsl:output.  With (2), your
> stylesheet would look like:
> 
>   <xsl:output method="xml" indent="no"
>       doctype-system="evaluate:evaluate(., '$dtdFile')"/>
> 
> The first argument to evaluate is dropped in XalanJ2 and the location of
> the extension function has moved.

I tried this and it just gives back whatever is within the
quotes.

<!DOCTYPE out SYSTEM "evaluate:evaluate(., '$param1')">

Sree

Re: xsl:output bug

Posted by Gary L Peskin <ga...@firstech.com>.
"Sree P.N. Sreeram" wrote:
> 
> Hello
> 
> I'm facing another problem with xalan.
> 
> System details:
> 
> SUN Solaris 2.6 using J2SE 1.2.2
> xalan-j_1_2
> 
> I pass a parameter for setting the DTD file in my output.
> Here's the code snippet from my xsl file.
> 
> <!-- Get the name of the DTD file that was passed -->
> <xsl:param name="dtdFile" select="'default value'"/>
> 
> <xsl:output method="xml" indent="no"
> doctype-system="$dtdFile"/>
> 
> Now, after processing, the output xml file does not replace
> $dtdFile with the string passed. It just retains it as
> $dtdFile (<!DOCTYPE blah SYSTEM "$dtdFile"> instead of
> <!DOCTYPE blah SYSTEM "blah.dtd">)
> 
> Is this a bug in xalan-j_1_2? Is there a way around this?

Sree --

The XSLT spec says that the value for doctype-system needs to be a
string.  You cannot supply a variable and expect to have it evaluated. 
All I can suggest is that you (1) output the !DOCTYPE yourself as text
using disable-output-escaping="yes' or (2) use the temporary Xalan
extension function evaluate.  I say temporary because the format of the
arguments to the evaluate extension function will change in XalanJ2. 
The code for the evaluate function was sent to the list a while back. 
Let me know if you need me to resend it.

Unfortunately, neither (1) nor (2) is very clean.  (1) allows you to get
away with using only standard XSLT but it treats the !DOCTYPE as text
rather than in the proper way as with xsl:output.  With (2), your
stylesheet would look like:

  <xsl:output method="xml" indent="no" 
      doctype-system="evaluate:evaluate(., '$dtdFile')"/>

The first argument to evaluate is dropped in XalanJ2 and the location of
the extension function has moved.

HTH,
Gary