[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



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