473,695 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

docbook xslt bug: System.NullRefe renceException: Object reference not set to an instance of an object

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:

private void Page_Load(objec t sender, System.EventArg s e) {

// load content
XslTransform trans = new XslTransform();
trans.Load("../funcspec_common/docbook-xsl-1.61.3/xhtml/docbook.xsl");

XPathDocument doc = new
XPathDocument(S erver.MapPath(" content.xml"));

StringWriter sw2 = new StringWriter();
XmlTextWriter xmlWriter = new XmlTextWriter(s w2); //Write to
StringWriter
xmlWriter.Forma tting = Formatting.Inde nted;
xmlWriter.Inden tation = 4;

trans.Transform (doc,null,xmlWr iter);
this.contentWri ter.Text = sw2.ToString();
sw2.Close();
xmlWriter.Close ();

}

</script>
<html>
<head>
<title>Function al Specs</title>
<link media="screen" href="../funcspec_common/examplesite1.cs s"
type="text/css" rel="stylesheet " />
</head>
<body>
<form method="post" runat="server">
<asp:literal id="contentWrit er" Runat="server"> </asp:literal>
</form>
</body>
</html>
I receive the following error:

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.NullRefe renceException: Object reference not
set to an instance of an object.

Source Error:

The source code that generated this unhandled exception can only be
shown when compiled in debug mode. To enable this, please follow one
of the below steps, then request the URL:

1. Add a "Debug=true " directive at the top of the file that generated
the error. Example:

<%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your
application:

<configuratio n>
<system.web>
<compilation debug="true"/>
</system.web>
</configuration>

Note that this second technique will cause all files within a given
application to be compiled in debug mode. The first technique will
cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a
memory/performance overhead. You should make sure that an application
has debugging disabled before deploying into production scenario.

Stack Trace:
[NullReferenceEx ception: Object reference not set to an instance of an
object.]
System.Xml.XPat h.FilterQuery.S etXsltContext(X sltContext input) +11
System.Xml.XPat h.FilterQuery.S etXsltContext(X sltContext input) +15
System.Xml.XPat h.MergeFilterQu ery.SetXsltCont ext(XsltContext input)
+25
System.Xml.XPat h.CompiledXpath Expr.SetContext (XmlNamespaceMa nager
nsManager) +134
System.Xml.Xsl. Processor.GetCo mpiledQuery(Int 32 key) +96
System.Xml.Xsl. ApplyTemplatesA ction.Execute(P rocessor processor,
ActionFrame frame) +296
System.Xml.Xsl. ActionFrame.Exe cute(Processor processor) +24
System.Xml.Xsl. Processor.Execu te() +79
System.Xml.Xsl. XslTransform.Tr ansform(IXPathN avigable input,
XsltArgumentLis t args, XmlWriter output) +264
ASP.printable_h tml_aspx.Page_L oad(Object sender, EventArgs e) +170
System.Web.UI.C ontrol.OnLoad(E ventArgs e) +55
System.Web.UI.C ontrol.LoadRecu rsive() +27
System.Web.UI.P age.ProcessRequ estMain() +731


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.432 2.573;
ASP.NET Version:1.1.432 2.573
Nov 11 '05 #1
7 8098
mike p. wrote:
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.


This is well-known (and confirmed) bug in XslTransform (both 1.0 and 1.1
affected), see
http://groups.google.com/groups?hl=e...549b001&rnum=2
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #2
The bug in the email thread pointed by Oleg was with cloning OR boolean
expressions in multiple threads. This is fixed in V1.1 SDK.

From Mike's call stack this looks like a different issue with XsltContext.
Can you share your XSLT with me so that I can take a look.

Thanks,
Prajakta Joshi (MS)

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/copyright.htm.
"Oleg Tkachenko" <ol***@multicon n.com> wrote in message
news:uD******** ******@tk2msftn gp13.phx.gbl...
mike p. wrote:
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.
This is well-known (and confirmed) bug in XslTransform (both 1.0 and 1.1
affected), see

http://groups.google.com/groups?hl=e...549b001&rnum=2 --
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #3
I am using the standard docbook xhtml xslt - the most
recent version available on sourceforge. Thanks for your
help.
-----Original Message-----
The bug in the email thread pointed by Oleg was with cloning OR booleanexpressions in multiple threads. This is fixed in V1.1 SDK.
From Mike's call stack this looks like a different issue with XsltContext.Can you share your XSLT with me so that I can take a look.

Thanks,
Prajakta Joshi (MS)

--
This posting is provided "AS IS" with no warranties, and confers no rights.Use of included script samples are subject to the terms specified athttp://www.microsoft.com/info/copyright.htm.
"Oleg Tkachenko" <ol***@multicon n.com> wrote in message
news:uD******* *******@tk2msft ngp13.phx.gbl.. .
mike p. wrote:
> 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.


This is well-known (and confirmed) bug in XslTransform (both 1.0 and 1.1 affected), see

http://groups.google.com/groups?hl=en&lr=&ie=UTF-

8&th=71929b2b75 49b001&rnum=2
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

.

Nov 11 '05 #4
mike wrote:
I am using the standard docbook xhtml xslt - the most
recent version available on sourceforge. Thanks for your
help.

Ok, then provide your content.xml document for us to be able to
reproduce the problem.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #5
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article SYSTEM "http://www.oasis-
open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY functionalareas
SYSTEM "functionalarea s.xml">
]>
<article>
<title>
<abbrev/>Functional Spec</title>
<tocchap>
<tocentry/>
<toclevel1>
<tocentry id="a">A</tocentry>
</toclevel1>
<toclevel1>
<tocentry id="b">B</tocentry>
</toclevel1>
<toclevel1>
<tocentry id="c">C</tocentry>
</toclevel1>
<toclevel1>
<tocentry id="d">D</tocentry>
</toclevel1>
<toclevel1>
<tocentry id="e">E</tocentry>
</toclevel1>
<toclevel1>
<tocentry id="f">F</tocentry>
</toclevel1>
</tocchap>
<section id="cover_page" >
<title/>
<mediaobject>
<imageobject>
<imagedata
fileref="../common/client_logo.eps " format="EPS"/>
</imageobject>
<imageobject>
<imagedata
fileref="../common/client_logo.gif " format="GIF"/>
</imageobject>
</mediaobject>
</section>
<section id="overview">
<title>Introduc tion</title>
<para>The purpose of this document is to
collect, analyze, and define the external behavior and
features for <abbrev/>, as well as nonfunctional
requirements, design constraints, and other factors
necessary to provide a complete, comprehensive description
of the software requirements. This document focuses on
functional and non-functional requirements rather than
technology, and is intended to answer questions relating
to what <abbrev/>should accomplish, and for whom. This
document describes both what needs are to be fulfilled and
how those needs are to be fulfilled through the functional
and non-functional requirements and use case
specifications.
</para>
<para>
This document serves as the basis for discussion and
agreement among the stakeholder communities for the
<abbrev/> project, which include:
</para>
<itemizedlist spacing="normal "
mark="bullet">
<listitem>
<simpara> The project
department for <abbrev/>, which serves as the proxy for
the customer and the user.</simpara>
</listitem>
<listitem>
<simpara> the project team
developing the application.</simpara>
</listitem>
<listitem>
<simpara> The management
team, which will be held responsible for the business
outcome of the endeavor.</simpara>
</listitem>
</itemizedlist>
<para>
It is important that the entire stakeholder community have
a shared understanding of the requirements of <abbrev/>. A
common understanding of requirements ensures that the
product described in this document is both what is desired
by business users and that what is desired is delivered by
the creative and technical teams. The completeness of this
document directly impacts the completeness, quality, and
timely delivery of the eventual product.
</para>
</section>
<section id="b">
<title>Client Development
Guidelines</title>
<para>
All development should follow standards outlined
in the Standards Version 2.0 document provided by
Genentech. This document outlines technical, creative, and
content standards.
</para>
<para>
<emphasis>Stand ards Version
2.0</emphasis>
<itemizedlist >
<listitem>
<simpara>
<ulink
url="../funcspec_common/website_standar ds2.htm"
type="popup">HT ML Format</ulink>
</simpara>
</listitem>
<listitem>
<simpara>
<ulink
url="../funcspec_common/website_standar ds2.pdf"
type="popup">PD F Format</ulink>
</simpara>
</listitem>
</itemizedlist>
</para>
</section>
&functionalarea s;
<section id="printabledo cument">
<title>Printabl e Document</title>
<para>A printable version of these
specifications is available <ulink
url="printable_ html.aspx" type="popup">in HTML
format</ulink>
</para>
</section>
</article>

<!-- functionalareas .xml -->
<!-- edited with XMLSPY v5 rel. 4 U
(http://www.xmlspy.com) by sadf (safd) -->
<section id="functionala reas">
<title>hello</title>
<para>hello</para>
</section>
-----Original Message-----
mike wrote:
I am using the standard docbook xhtml xslt - the most
recent version available on sourceforge. Thanks for your help.Ok, then provide your content.xml document for us to be

able toreproduce the problem.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

.

Nov 11 '05 #6
Hello!

Unable to reproduce unfortunately. When I run your document against docbook
xslt I got as expected old notorious one:

System.Xml.Xsl. XsltCompileExce ption:
file:///D:/docbook/docbook-xsl-1.61.3/xhtml/docbook.xsl(24, 2) :
---> System.Xml.Xsl. XsltCompileExce ption:
file:///D:/docbook/docbook-xsl-1.61.3/common/common.xsl(1554 ,10) :
---> System.Xml.Xsl. XsltException: '$years[1] + 1' is an invalid XPath
expression. ---> System.Xml.XPat h.XPathExceptio n: XsltContext is needed for
this query because of an unknown function.
at System.Xml.XPat h.VariableQuery .ReturnType()
at System.Xml.XPat h.PositionQuery .ReturnType()
at System.Xml.XPat h.FilterQuery.R eturnType()
at System.Xml.XPat h.NumericExpr.. ctor(Op op, IQuery opnd1, IQuery opnd2)
at System.Xml.XPat h.QueryBuilder. ProcessOperator (Operator root, IQuery
qyInput, Boolean& cache, Boolean& position)
at System.Xml.XPat h.QueryBuilder. ProcessNode(Ast Node root, IQuery qyInput,
Int32 parent, AxisType parentaxis, Boolean& cache, Boolean& position)
at System.Xml.XPat h.QueryBuilder. Build(AstNode root, String query)
at System.Xml.Xsl. Compiler.AddQue ry(String xpathQuery, Boolean allowVar,
Boolean allowKey)

If I modify $years[1] + 1 to number($years[1]) + 1 at 1554 line of
common/common.xsl I get another (but similar) exception:

System.Xml.Xsl. XsltCompileExce ption:
file:///D:/docbook/docbook-xsl-1.61.3/xhtml/docbook.xsl(32, 2) :
---> System.Xml.Xsl. XsltCompileExce ption:
file:///D:/docbook/docbook-xsl-1.61.3/xhtml/autoidx.xsl(36, 4) :
---> System.NullRefe renceException: Object reference not set to an instance
of an object.
at System.Xml.XPat h.FilterQuery.C lone()
at System.Xml.XPat h.FilterQuery.C lone()
at System.Xml.XPat h.MergeFilterQu ery.Clone()
at System.Xml.XPat h.OrQuery.Clone ()
at System.Xml.XPat h.MethodOperand .Clone()
at System.Xml.XPat h.LogicalExpr.C lone()
at System.Xml.XPat h.BooleanFuncti ons.Clone()
at System.Xml.XPat h.AndExpr.Clone ()
at System.Xml.XPat h.FilterQuery.C lone()
at System.Xml.XPat h.QueryBuilder. ProcessFilter(F ilter root, Boolean&
cache, Boolean& position)
....

That's deeply in autoidx.xsl, which probably nobody but Jeni Tennison
understands, in this crazy XPath expression:

<xsl:variable name="terms"
select="//indexterm[count(.|key('le tter',translate (substring(norm alize-space(concat(pr imary/@sortas,
primary[not(@sortas)])), 1, 1),
'abcdefghijklmn opqrstuvwxyz',

'ABCDEFGHIJKLMN OPQRSTUVWXYZ'))[count(ancestor: :node()|$scope) =
count(ancestor: :node())][1]) = 1 and not(@class = 'endofrange')]"/>

Hope I'll find a time to debug it further...
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #7
Yes, I received the autoidx bug as well. I forgot to
mention that I changed the docbook stylesheet
number/string handling lines as detailed in:

http://groups.google.com/groups?hl=e...=UTF-8&oe=UTF-
8&threadm=e0HAV 4iGDHA.2852%
40tk2msftngp13. phx.gbl&rnum=1& prev=/groups%3Fq%3Ddo cbook%
2Basp.net%26hl% 3Den%26lr%3D%26 ie%3DUTF-8%26oe%3DUTF-8%
26selm%3De0HAV4 iGDHA.2852%2540 tk2msftngp13.ph x.gbl%26rnum%
3D1

with this patch, i no longer get the autoidx bug, just the
bug i originally posted.
-----Original Message-----
Hello!

Unable to reproduce unfortunately. When I run your document against docbookxslt I got as expected old notorious one:

System.Xml.Xsl .XsltCompileExc eption:
file:///D:/docbook/docbook-xsl-1.61.3/xhtml/docbook.xsl (24,2) : ---> System.Xml.Xsl. XsltCompileExce ption:
file:///D:/docbook/docbook-xsl-1.61.3/common/common.xsl (1554,10) : ---> System.Xml.Xsl. XsltException: '$years[1] + 1' is an invalid XPathexpression. ---> System.Xml.XPat h.XPathExceptio n: XsltContext is needed forthis query because of an unknown function.
at System.Xml.XPat h.VariableQuery .ReturnType()
at System.Xml.XPat h.PositionQuery .ReturnType()
at System.Xml.XPat h.FilterQuery.R eturnType()
at System.Xml.XPat h.NumericExpr.. ctor(Op op, IQuery opnd1, IQuery opnd2) at System.Xml.XPat h.QueryBuilder. ProcessOperator (Operator root, IQueryqyInput, Boolean& cache, Boolean& position)
at System.Xml.XPat h.QueryBuilder. ProcessNode(Ast Node root, IQuery qyInput,Int32 parent, AxisType parentaxis, Boolean& cache, Boolean& position) at System.Xml.XPat h.QueryBuilder. Build(AstNode root, String query) at System.Xml.Xsl. Compiler.AddQue ry(String xpathQuery, Boolean allowVar,Boolean allowKey)

If I modify $years[1] + 1 to number($years[1]) + 1 at 1554 line ofcommon/common.xsl I get another (but similar) exception:

System.Xml.Xsl .XsltCompileExc eption:
file:///D:/docbook/docbook-xsl-1.61.3/xhtml/docbook.xsl (32,2) : ---> System.Xml.Xsl. XsltCompileExce ption:
file:///D:/docbook/docbook-xsl-1.61.3/xhtml/autoidx.xsl (36,4) : ---> System.NullRefe renceException: Object reference not set to an instanceof an object.
at System.Xml.XPat h.FilterQuery.C lone()
at System.Xml.XPat h.FilterQuery.C lone()
at System.Xml.XPat h.MergeFilterQu ery.Clone()
at System.Xml.XPat h.OrQuery.Clone ()
at System.Xml.XPat h.MethodOperand .Clone()
at System.Xml.XPat h.LogicalExpr.C lone()
at System.Xml.XPat h.BooleanFuncti ons.Clone()
at System.Xml.XPat h.AndExpr.Clone ()
at System.Xml.XPat h.FilterQuery.C lone()
at System.Xml.XPat h.QueryBuilder. ProcessFilter(F ilter root, Boolean&cache, Boolean& position)
....

That's deeply in autoidx.xsl, which probably nobody but Jeni Tennisonunderstands, in this crazy XPath expression:

<xsl:variabl e name="terms"
select="//indexterm[count(.|key('le tter',translate (substring(norm alize-space(concat(pr imary/@sortas,primary[not(@sortas)])), 1, 1),
'abcdefghijklmn opqrstuvwxyz',

'ABCDEFGHIJKLM NOPQRSTUVWXYZ') )[count(ancestor: :node() |$scope) =count(ancestor ::node())][1]) = 1 and not(@class = 'endofrange')]"/>
Hope I'll find a time to debug it further...
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

.

Nov 11 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1516
by: Thomas Kellerer | last post by:
Hello, I'm not sure if this is the right newsgroup, but I feel it is more approriate then comp.lang.java.* I'm writing documentation with DocBook and I'm converting the xml file through an Ant XSLT task. This works fine although I'm really not very experienced with XSLT. Now I want to use the <textdata> tag in my DocBook xml to include a
3
4067
by: ZJT | last post by:
What are the ways and corresponding tools to transform a docbook document to a pdf document? Thanks a lot!
1
1721
by: David Montgomery | last post by:
Hi, Our company provides ASP services to multiple government agencies. These agencies in turn provide our ASP services to the general public through their web portals. As part of our service we need to provide end-user documentation for the general public to use our ASP tools, providing really simple to understand step-by-step instruction with lots and lots of picture examples. As part of my project to create this documentation, I...
3
2156
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 exception: _ctl1_DesktopThreePanes1_ThreePanes__ctl3_xml1: Failed! Object reference not set to an instance of an object. (The IE6.0 xml-parser transform the docbook file
0
9774
by: muralidharan | last post by:
WebForm1.aspx Code: <%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %> <ComponentArt:TreeView id="TreeView1" Height="520" AutoPostBackOnNodeMove="false" DragAndDropEnabled="true" NodeEditingEnabled="False" KeyboardEnabled="true" CssClass="TreeView" NodeCssClass="TreeNode" SelectedNodeCssClass="SelectedTreeNode" HoverNodeCssClass="HoverTreeNode" NodeEditCssClass="NodeEdit"
33
3310
by: Ken | last post by:
I have a C# Program where multiple threads will operate on a same Hashtable. This Hashtable is synchronized by using Hashtable.Synchronized(myHashtable) method, so no further Lock statements are used before adding, removing or iterating the Hashtable. The program runs in a high workload environment. After running a few days, now it suddenly catchs this Exception when inserting a pair of key and object, stacktrace =...
2
7821
by: Raed Sawalha | last post by:
i have a windows form(Main) with listview, when click an item in listview i open other window form (Sub) which generate the selected item from parent window in as treeview items when click any item in treeview i display the content item in axWebBrowser, i close the sub form normally when i close the main the following error is generated An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll ...
2
2769
by: sxiao | last post by:
Hi, there I got a NullReferenceException when there are more than one users trying to open the same page at the same time. The senerio is: Two users logged into the web application using the Windows domain user account and tried to open the same page which has the databasde query code. When the two user tried to open the same page at the same time, there is a runtime error messsage showing as follows:
6
22212
by: William Mild | last post by:
I must be getting brain fried. I can't see the error. Create a new web form with the following code begind: Public Class test Inherits System.Web.UI.Page Public Class ReportCardData Public Structure Attend Dim DaysTardy As Double
0
8617
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8553
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8971
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6483
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5827
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4332
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4570
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2251
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.