RE: [xsl] Re: [xslt transform & grouping] Using the Muenchian Method?

Subject: RE: [xsl] Re: [xslt transform & grouping] Using the Muenchian Method?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 6 Oct 2004 10:40:08 +0100
I think you can be pretty sure that a NullReferenceException 20 levels deep
into system classes, with no user-written code in sight, is indeed a
Microsoft bug.

Michael Kay
http://www.saxonica.com/

 

> -----Original Message-----
> From: Michael PG [mailto:xrow@xxxxxxx] 
> Sent: 06 October 2004 10:13
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Re: [xslt transform & grouping] Using the 
> Muenchian Method?
> 
> Vendor: Microsoft
> Vendor URL: http://www.microsoft.com
> XSLT Version: 1
> 
> -
> 
> Exception Details:
> 
> System.NullReferenceException: Object reference not set to an 
> instance of an 
> object.
> 
> Source Error:
> 
> Line 60: myXslTrans.Transform(myXPathDoc, null, writer, null);
> 
> Stack Trace:
> 
> 
> [NullReferenceException: Object reference not set to an 
> instance of an 
> object.]
>    System.Xml.XPath.FilterQuery.SetXsltContext(XsltContext input)
>    System.Xml.XPath.FilterQuery.SetXsltContext(XsltContext input)
>    System.Xml.XPath.MergeFilterQuery.SetXsltContext(XsltContext input)
>    System.Xml.XPath.OrQuery.SetXsltContext(XsltContext context)
>    System.Xml.XPath.MethodOperand.SetXsltContext(XsltContext context)
>    System.Xml.XPath.LogicalExpr.SetXsltContext(XsltContext context)
>    System.Xml.XPath.FilterQuery.SetXsltContext(XsltContext input)
>    System.Xml.XPath.MergeFilterQuery.SetXsltContext(XsltContext input)
>    System.Xml.XPath.CompiledXpathExpr.SetContext(XmlNamespaceManager 
> nsManager)
>    System.Xml.Xsl.Processor.GetCompiledQuery(Int32 key)
>    System.Xml.Xsl.Processor.StartQuery(XPathNavigator 
> context, Int32 key)
>    System.Xml.Xsl.ForEachAction.Execute(Processor processor, 
> ActionFrame 
> frame)
>    System.Xml.Xsl.ActionFrame.Execute(Processor processor)
>    System.Xml.Xsl.Processor.Execute()
>    System.Xml.Xsl.XslTransform.Transform(XPathNavigator input, 
> XsltArgumentList args, XmlWriter output, XmlResolver resolver)
>    System.Xml.Xsl.XslTransform.Transform(IXPathNavigable input, 
> XsltArgumentList args, XmlWriter output, XmlResolver resolver)
>    com.tetrapak.gts.ctip.tpop.mm_main_v2.Page_Load(Object 
> sender, EventArgs 
> e) in c:\inetpub\wwwroot\mm_main_v2.aspx.cs:60
>    System.Web.UI.Control.OnLoad(EventArgs e)
>    System.Web.UI.Control.LoadRecursive()
>    System.Web.UI.Page.ProcessRequestMain()
> 
> 
> >
> >-----BEGIN PGP SIGNED MESSAGE-----
> >Hash: SHA1
> >
> >Posting the exact exception message and the version of your processor
> >would have been much more helpful.
> >
> >Wolfgang
> >
> >
> >Michael PG wrote:
> >
> >| I don't think that's there'a an bug in msxml.
> >|
> >| -M
> >|
> >|
> >|> From: "Werner, Wolfgang" <mail@xxxxxxxxxxxxxxxxxxx>
> >|> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >|> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >|> Subject: Re: [xsl] Re: [xslt transform & grouping] Using 
> the Muenchian
> >|> Method?
> >|> Date: Wed, 06 Oct 2004 09:57:04 +0200
> >|>
> >| xsltproc, XMLSpy's internal processor and msxml 3.0 yield 
> the following
> >| result (differing only in whitespace) using the files in 
> your last mail:
> >| <Documents>
> >| ~  <Document name="sub"/>
> >| ~  <Document name="main">
> >| ~    <Article title="1.2" info="main" filter="food"/>
> >| ~    <Article title="2.2" info="main" filter="food"/>
> >| ~  </Document>
> >| </Documents>
> >|
> >| So perhaps it's a bug in msxml 4.0, as Michael suggested.
> >|
> >| Wolfgang
> >|
> >| Michael PG wrote:
> >|
> >| | Hi Anton,
> >| |
> >| |
> >| | Here's the XSL stylesheet:
> >| |
> >| | <?xml version="1.0" encoding="UTF-8"?>
> >| |
> >| | <xsl:stylesheet version="1.0"
> >| | xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> >| |
> >| |    <xsl:output method="xml" version="1.0" encoding="utf-8"
> >| indent="yes"/>
> >| |
> >| |    <xsl:key name="by-info" match="Article" use="@info"/>
> >| |
> >| |    <xsl:param name="filter" select="'food'"></xsl:param>
> >| |
> >| |    <xsl:template match="Documents">
> >| |
> >| |         <!-- @filter='' will be true if it is there and 
> empty or if it
> >| | is not there at all) -->
> >| |         <xsl:apply-templates select="*[@filter='' or
> >| @filter=$filter]"/>
> >| |
> >| |             <Documents>
> >| |                  <xsl:for-each select="Document[@filter='' or
> >| | 
> @filter=$filter]/Article[count(.|key('by-info',@info)[@filter='' or
> >| | @filter=$filter][1])=1]">
> >| |                     <Document name="{@info}">
> >| |                          <xsl:copy-of
> >| | select="key('by-info',@info)[@filter=$filter]"/>
> >| |                     </Document>
> >| |                   </xsl:for-each>
> >| |             </Documents>
> >| |
> >| |         </xsl:template>
> >| |
> >| | </xsl:stylesheet>
> >| |
> >| |
> >| | The line proposed by David C. gives an exception.
> >| |
> >| | <xsl:for-each select="Document[@filter='' or
> >| | 
> @filter=$filter]/Article[count(.|key('by-info',@info)[@filter='' or
> >| | @filter=$filter][1])=1]">
> >| |
> >| |
> >| | The XML looks like:
> >| |
> >| | <?xml version="1.0" encoding="utf-8"?>
> >| |
> >| | <Documents>
> >| |     <Document chapter="1" title="title 1" 
> href="file1.xml" filter="">
> >| |         <Article title="1.1" info="sub" filter="drink"/>
> >| |         <Article title="1.2" info="main" filter="food"/>
> >| |     </Document>
> >| |     <Document chapter="2" title="title 2" href="file2.xml"
> >| filter="drink">
> >| |         <Article title="2.1" info="sub" filter="drink"/>
> >| |         <Article title="2.2" info="main" filter="food"/>
> >| |     </Document>
> >| | </Documents>
> >| |
> >| |
> >| | Thanx.
> >| |
> >| | -M
> >| |
> >| |
> >| |> From: Anton Triest <anton@xxxxxxxx>
> >| |> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >| |> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >| |> Subject: Re: [xsl] Re: [xslt transform & grouping] 
> Using the Muenchian
> >| |> Method?
> >| |> Date: Wed, 06 Oct 2004 00:47:56 +0200
> >| |>
> >| |> Michael PG wrote:
> >| |>
> >| |>> After adding the suggested line I got an exception 
> lake it last case.
> >| |>>
> >| |>> select="Document[@filter='' or
> >| |>> 
> @filter=$filter]/Article[count(.|key('by-info',@info)[@filter='' or
> >| |>> @filter=$filter][1])=1]">
> >| |>
> >| |>
> >| |>
> >| |> Hi Michael (I'm jumping in again, was away yesterday)
> >| |>
> >| |> did you define the key in this template? (that caused 
> the exception
> >| |> last time, didn't it)
> >| |> if so, maybe you'll better post the complete stylesheet 
> once more...
> >| |> (+ exception details)
> >| |>
> >| |> Anton
> >| |>
> >| |>
> >| |> 
> >| |>
> >| |
> >| | _________________________________________________________________
> >| | On the road to retirement? Check out MSN Life Events for 
> advice on how
> >| | to get there! 
> http://lifeevents.msn.com/category.aspx?cid=Retirement
> >| |
> >| |
> >| | 
> >| |
> >| |
> >|
> >|>
> >- 
> >|>
> >
> >| _________________________________________________________________
> >| FREE pop-up blocking with the new MSN Toolbar ? get it now!
> >| http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
> >
> >
> >| 
> >
> >
> >
> >-----BEGIN PGP SIGNATURE-----
> >Version: GnuPG v1.2.4 (Cygwin)
> >Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
> >
> >iD8DBQFBY7PFqjaicDyx8o8RAtaSAKCK15QCOCxiwKIZgJ+z9JQqRPVNrACfXu1n
> >6FzRHNJrHdmbQ7t5ZCKDrX0=
> >=uWRD
> >-----END PGP SIGNATURE-----
> >
> 
> _________________________________________________________________
> Get ready for school! Find articles, homework help and more 
> in the Back to 
> School Guide! http://special.msn.com/network/04backtoschool.armx

Current Thread