Re: [xslt] suppressing warning from document()



You might investigate XML::LibXML::InputCallback:

	
http://search.cpan.org/~pajas/XML-LibXML-1.63/lib/XML/LibXML/InputCallba
ck.pod

If you override that you can search for the file in your own code.  This
may not work with AxKit (which I haven't used) and it may have some
performance issues.  I implemented it once and got it working but ended
up deciding to pre-process the XSLT instead which worked better for my
purposes.

It would be nice if there was a "include path" for XSLT.  Though I
suppose that would be engine-specific, not part of the specification,
and therefore not always supported.  Or maybe it's there and I'm too
ignorant to know.  ;)

mma 

> -----Original Message-----
> From: xslt-bounces gnome org [mailto:xslt-bounces gnome org] 
> On Behalf Of Sebastian Rahtz
> Sent: Tuesday, July 10, 2007 4:45 AM
> To: xslt gnome org
> Subject: [xslt] suppressing warning from document()
> 
> I want to load an external file if it exists, otherwise load 
> another file, and so on.
> 
> So in my XSL I do this:
>  
> <xsl:choose>
>           <xsl:when test="boolean(document('sidebar.xml',/))">
>         <xsl:message>found at .</xsl:message>
>           </xsl:when>
>           <xsl:when test="boolean(document('../sidebar.xml',/))">
>         <xsl:message>found at ..</xsl:message>
>           </xsl:when>
>           <xsl:when test="boolean(document('../../sidebar.xml',/))">
>         <xsl:message>found at ../..</xsl:message>
>           </xsl:when>
>         </xsl:choose>
> 
> which works fine, but of course the side effect of the first 
> <when> is a message:
> 
>    warning: failed to load external entity "sidebar.xml"
> 
> which is not very nice. Is there any way of avoiding it?
> or a better method to check if a file exists before reading it?
> 
> Alternatively, how can I get libxslt to do XInclude 
> processing on the XSL itself (as opposed to the input XML)?
> 
> -- 
> Sebastian Rahtz      
> Information Manager, Oxford University Computing Services
> 13 Banbury Road, Oxford OX2 6NN. Phone +44 1865 283431
> 
> _______________________________________________
> xslt mailing list, project page http://xmlsoft.org/XSLT/ 
> xslt gnome org http://mail.gnome.org/mailman/listinfo/xslt
> 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]