Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^5: XML::XSLT problem

by gellyfish (Monsignor)
on Nov 17, 2006 at 15:54 UTC ( #584743=note: print w/ replies, xml ) Need Help??


in reply to Re^4: XML::XSLT problem
in thread XML::XSLT problem

Quite. But if it is a bug I will need to see the XSL to diagnose and fix it. From the location of the error it would appear that the problem is with the way either a <xsl:variable /> or <xsl:param /> is being dealt with but I'd still need to see the inputs to see what is really going on.

/J\


Comment on Re^5: XML::XSLT problem
Select or Download Code
Re^6: XML::XSLT problem
by artist (Parson) on Nov 17, 2006 at 18:43 UTC
    Interesting.. I found <fo> tags in my original XSL. Should they be processed in correctly with XSLT or should throw the error?

    Update: Actually, I <fo> tags works fine, but <xsl:variable> tag gives problem: Here is the sample code

    <xsl:variable name="TextFontSize">10</xsl:variable>
    On further investigation, I found that this tag works fine inside <xsl:template> but fails when you declare it globally, See Example 3.
    --Artist

      XML::XSLT should just ignore the fo stuff, though that isn't being tested.

      But yes you have uncovered a bug in a code path which wasn't being tested. Basically the problem is with an outer <xsl:variable /> declaration where there is a literal value (like you have there) rather than supplied with a value attribute. It needs to create a document fragment to store the results of evaluating the literal value and createDocumentFragment() needs to be called as a method of the XML::DOM::Document object, but as the top level variables are evaluated on the first parse of the XSL document there isn't an XML::DOM::Document yet :-(.

      The bottom line is that whilst your example above could quite happily be expressed as:

      <xsl:variable name="TextFontSize" value="10" />
      I can't promise a quick fix that does the right thing as surprisingly it's going to require quite a large change, You might want to check out the version in CVS but that cheats with the document fragment and elicits a warning from XML::DOM and also doesn't respect any XML in the variable value but YMMV. Caveat Emptor etc etc.

      But I have a test for this now so it will get fixed eventually

      Thanks for the bug report, sorry I can't help you straight away.

      /J\

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://584743]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2015-07-04 21:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls