473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 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 2388
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.