Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^5: XML::XSLT problem

by rg0now (Chaplain)
on Apr 24, 2005 at 21:45 UTC ( #451044=note: print w/ replies, xml ) Need Help??


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

For me it appears that XML::XSLT croaks when it tries to open an external XML file. Line 62 of blog.xsl confirms it:

<xsl:for-each select="document('menu.xml')/menu/item">
Have you provided the file menu.xml for the XSLT processor? I guess you have not...:-)

What really makes me wonder here is that XML::LibXSLT gives fairly sane output, even without the menu.xml file. Now this is really strange! Though, I admit that I am not really an expert of XSLT....

Update: after setting the debug_callback for XML::LibXSLT it seems that the parser just silently ignores the missing file here (only noing that the for-each did not produce a node list). XML::XSLT appears to be much more picky here...


Comment on Re^5: XML::XSLT problem
Select or Download Code
Re^6: XML::XSLT problem
by bosshoff (Novice) on Apr 24, 2005 at 22:28 UTC
    So, once again I am proven wrong, and I am actually happy! I totally forgot that I included a template to import another xml document. I now have two concerns:

    1) Why was there not a more descriptive error; I didn't even see anything indicative of an error during import when I turned the debug switch on.

    2) How do I include multiple sources into the transformation process? If I am unable to do that, things are going to get very complicated, so much so that I'm going to have to seriously rethink going back to good 'ol perl interposed with html.

    Thanks for all the help rg0now, I probably would've thrown in the towel without your analysis.
      1) Why was there not a more descriptive error; I didn't even see anything indicative of an error during import when I turned the debug switch on.
      I am absolutely with you on this issue. I know that you are restricted to use XML::XSLT, but maybe it would be more beneficial to somehow migrate to XML::LibXML & co., because, for me at least, it have proven itself much more usable over the years. Also, it allows you to process multiple source files with the same stylesheet without reparsing (if this is what you aimed in point 2)), but I myself have never had to do such thing in reality...

      The answer to your first question is that it looks like a bug in the implementation of document() (the actually error is coming from XML::Parser because it is not able to open the file.) I'll have a look at adding a test case based on your example and see to fixing it for the next release. If you send me an email with examples of failing XML and XSLT then it will probably help expedite matters.

      As to your second question you probably want to try setting the base argument to the XML::XSLT constructor to the location of your files.

      /J\

        Alright, thanks for the help. I figured there was some argument I was missing for that; I would think that including other xml documents would be common practice.

        Here are the documents I was working with when I encountered this problem:

        XSL
        XML

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (11)
As of 2014-12-21 11:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (104 votes), past polls