472,807 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,807 software developers and data experts.

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
6 2319
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Dr. Laurence Leff | last post by:
I am having trouble doing the basics with xmlto on Redhat to convert DocBook XML into the various files. I believe the problem is the first line on the files: Here is starter file (notes.xml):...
2
by: Simon Strandgaard | last post by:
I am trying to understand how to create a 'catalog.xml' file for my docbook-xml documents. If I understand correct a local catalog.xml file can both avoid hardcoding in makefiles (portability),...
3
by: ZJT | last post by:
What are the ways and corresponding tools to transform a docbook document to a pdf document? Thanks a lot!
0
by: Altsoft Xml2PDF | last post by:
There is a number of limitations in the built-in Microsoft .NET Framework XslTransform (System.Xml.Xsl.XslTransform) class which makes Microsoft .NET XSLT compiler incompatible with DocBook...
2
by: Yarco | last post by:
I'm learning for docbook under win32. I download: openjade-1_3_1-2-bin docbook-xml-4.4 docbook-dsssl-1.79 ldp.dsl And then copy all openjade bin\ to win32 system\, and then create a directory...
7
by: mike p. | last post by:
I have a docbook xml file, and am using standard docbook 1.61.3 xsl stylesheets to do xhtml transform. Transform works fine when using MSXML. When I try to do the following using asp.net 1.1: ...
3
by: Otmar Ganahl | last post by:
Hi! In my application I transform a docbook file to a html view using the webcontrol "Xml" (with a xsl).It works fine, except the using of the tag "fileref" in the docbook-file will cause an...
0
by: Jordan | last post by:
I'm attempting to load the Docbook stylesheet (version 1.61.3) into an XslTransform object using the load method. Unfortunately it finds a number of errors throughout the docbook and throws an...
2
by: Joseph Kesselman | last post by:
Since the recent "Docbook on Windows" question brought this up... I did a bit of checking on the current status of these schemas, what they're intended for and how they interrelate. IBM's Robert...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.