467,888 Members | 1,543 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,888 developers. It's quick & easy.

DocBook XSL and .NET XslTransform

Hello *,

I'm trying to transform my DocBook document with the FO stylesheet
from the DocBook XSL distribution (the transformation with the XHTML
stylesheet works).

I changed "$years[1] + 1" to "number($years[1]) + 1" two times in
common.xsl. But the transformation doesn't work anyway. The funny
thing is, that if I use the msxsl command line utility there is no
problem. But when I use nxslt (or my own code) then I get the
following error.
<snip>
Error occurred while executing stylesheet
'c:\docbook\xsl\fo\docbook.xsl'.

System.Xml.XPath.XPathException: The variable or param
'monospace.font.family' is either not defined or it is out of scope.
at System.Xml.XPath.VariableQuery.SetXsltContext(Xslt Context
context)
at System.Xml.XPath.StringFunctions.SetXsltContext(Xs ltContext
context)
at System.Xml.XPath.CompiledXpathExpr.SetContext(XmlN amespaceManager
nsManager)
at System.Xml.Xsl.Processor.GetValueQuery(Int32 key)
at System.Xml.Xsl.AvtEvent.Output(Processor processor, ActionFrame
frame)
at System.Xml.Xsl.CopyCodeAction.Execute(Processor processor,
ActionFrame frame)
at System.Xml.Xsl.ActionFrame.Execute(Processor processor)
at System.Xml.Xsl.Processor.Execute()
at System.Xml.Xsl.XslTransform.Transform(IXPathNaviga ble input,
XsltArgumentList args, Stream output)
at GotDotNet.Exslt.ExsltTransform.Transform(IXPathNav igable ixn,
XsltArgumentList arglist, Stream stream)
at NXslt.NXslt.Process()
</snip>
I googled for a solution but unlike with the number(...) thing I had
no luck - so any help is appreciated.

Best regards,
Bjoern
Nov 12 '05 #1
  • viewed: 2184
Share:
6 Replies
BLechmann wrote:

I'm trying to transform my DocBook document with the FO stylesheet
from the DocBook XSL distribution (the transformation with the XHTML
stylesheet works).

I changed "$years[1] + 1" to "number($years[1]) + 1" two times in
common.xsl. But the transformation doesn't work anyway. The funny
thing is, that if I use the msxsl command line utility there is no
problem. But when I use nxslt (or my own code) then I get the
following error.


This is ole well-known bug. I though it's fixed in .NET 1.1? Which .NET
version you are using?

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #2
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message

This is ole well-known bug. I though it's fixed in .NET 1.1? Which .NET
version you are using?


Hello Oleg,

thanks for your reply.

I'm not at work right now, but I think it is .NET 1.1 (we're using
VS.NET 2003). Just now I tried a transformation at home with nxslt
under .NET 1.1 with the same error.

Bye,
Bjoern
Nov 12 '05 #3
Yes, we're using .NET 1.1.

I think the problem is, that the .NET XSL processor doesn't accept the
use of variables/params, if they are declared later in the file.

Is there a patch that fixes this behaviour?

Regards,
Bjoern
Nov 12 '05 #4
BLechmann wrote:
Yes, we're using .NET 1.1.

I think the problem is, that the .NET XSL processor doesn't accept the
use of variables/params, if they are declared later in the file.


No, it's way more convolute. Looks like XslTransform doesn't like
vars/params defined later when they are used in attribute context.
That's definitely a nasty bug.
Here is a repro:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="bar">
<blah attr="{$foo}"/>
</xsl:param>
<xsl:param name="foo" select="'foo'"/>
<xsl:template match="/">
<xsl:copy-of select="$bar"/>
</xsl:template>
</xsl:stylesheet>

The same:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="bar">
<blah>
<xsl:attribute name="attr">
<xsl:value-of select="$foo"/>
</xsl:attribute>
</blah>
</xsl:param>
<xsl:param name="foo" select="'foo'"/>
<xsl:template match="/">
<xsl:copy-of select="$bar"/>
</xsl:template>
</xsl:stylesheet>
The result of loading:

System.Xml.XPath.XPathException: The variable or param 'foo' is either
not defined or it is out of scope.
at System.Xml.XPath.VariableQuery.SetXsltContext(Xslt Context context)
at System.Xml.XPath.StringFunctions.SetXsltContext(Xs ltContext context)
at System.Xml.XPath.CompiledXpathExpr.SetContext(XmlN amespaceManager
nsManager)
at System.Xml.Xsl.Processor.GetValueQuery(Int32 key)
at System.Xml.Xsl.AvtEvent.Output(Processor processor, ActionFrame
frame)
at System.Xml.Xsl.CopyCodeAction.Execute(Processor processor,
ActionFrame frame)
at System.Xml.Xsl.ActionFrame.Execute(Processor processor)
at System.Xml.Xsl.Processor.Execute()
at System.Xml.Xsl.XslTransform.Transform(IXPathNaviga ble input,
XsltArgumentList args, Stream output)
at GotDotNet.Exslt.ExsltTransform.Transform(IXPathNav igable ixn,
XsltArgumentList arglist, Stream stream)
at NXslt.NXslt.Process()
--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #5
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message news:<uy**************@TK2MSFTNGP12.phx.gbl>...
No, it's way more convolute. Looks like XslTransform doesn't like
vars/params defined later when they are used in attribute context.
That's definitely a nasty bug.


Is there a solution for this problem (a bug fix would be the best :-)?
I can't believe that we are the only persons who want to generate FO's
with .NET-XslTransform and DocBook-XSL.

Thanks,
Bjoern
Nov 12 '05 #6
This problem is fixed. The patch is available here:
http://alt-soft.com/support_kb_docbo...ltransform.jsp

Best Regards,
Altsoft Xml2PDF
http://alt-soft.com/

Hello *,

I'm trying to transform my DocBook document with the FO stylesheet
from the DocBook XSL distribution (the transformation with the XHTML
stylesheet works).

I changed "$years[1] + 1" to "number($years[1]) + 1" two times in
common.xsl. But the transformation doesn't work anyway. The funny
thing is, that if I use the msxsl command line utility there is no
problem. But when I use nxslt (or my own code) then I get the
following error.
<snip>
Error occurred while executing stylesheet
'c:\docbook\xsl\fo\docbook.xsl'.

System.Xml.XPath.XPathException: The variable or param
'monospace.font.family' is either not defined or it is out of scope.
at System.Xml.XPath.VariableQuery.SetXsltContext(Xslt Context
context)
at System.Xml.XPath.StringFunctions.SetXsltContext(Xs ltContext
context)
at System.Xml.XPath.CompiledXpathExpr.SetContext(XmlN amespaceManager
nsManager)
at System.Xml.Xsl.Processor.GetValueQuery(Int32 key)
at System.Xml.Xsl.AvtEvent.Output(Processor processor, ActionFrame
frame)
at System.Xml.Xsl.CopyCodeAction.Execute(Processor processor,
ActionFrame frame)
at System.Xml.Xsl.ActionFrame.Execute(Processor processor)
at System.Xml.Xsl.Processor.Execute()
at System.Xml.Xsl.XslTransform.Transform(IXPathNaviga ble input,
XsltArgumentList args, Stream output)
at GotDotNet.Exslt.ExsltTransform.Transform(IXPathNav igable ixn,
XsltArgumentList arglist, Stream stream)
at NXslt.NXslt.Process()
</snip>
I googled for a solution but unlike with the number(...) thing I had
no luck - so any help is appreciated.

Best regards,
Bjoern


User submitted from AEWNET (http://www.aewnet.com/)
Nov 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Dr. Laurence Leff | last post: by
2 posts views Thread by Simon Strandgaard | last post: by
3 posts views Thread by ZJT | last post: by
reply views Thread by Altsoft Xml2PDF | last post: by
2 posts views Thread by Yarco | last post: by
3 posts views Thread by Otmar Ganahl | last post: by
reply views Thread by Jordan | last post: by
2 posts views Thread by Joseph Kesselman | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.