RE: [xsl] document() access. The combinations

Subject: RE: [xsl] document() access. The combinations
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 29 Apr 2003 11:09:21 +0100
Saxon uses the Java URL class for resolving URLs. This has some
limitations, for example it doesn't seem to be able to handle Windows
networked filenames. I'm moving to the JDK 1.4 java.net.URI class which
seems to do a better job; you can try this yourself with Saxon 6.5.2 if
you like by writing your own URIResolver.

Michael Kay


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> David.Pawson@xxxxxxxxxxx
> Sent: 29 April 2003 08:56
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] document() access. The combinations
> 
> 
> Below is a stylesheet that tests out the combinations
> of file access nameing I can think of and test.
> I've tested it with saxon 6.5.2, with warnings on, but set to recover.
> 
> since Saxon is the only engine I run these days,
> I'd appreciate other people running it on their processors,
> if they can get past the error handling.
> 
> http://www.ietf.org/rfc/rfc1738.txt says what it should be.
> I'm curious about what happens practically.
> 
> regards DaveP
> 
> 
> 
> 
> The results are:
> 
> Test on file access
> [uriIncl.xml] OK
> Content is Some other doc 
> file:/uriIncl.xml failed
> file://uriIncl.xml failed
> file:///uriIncl.xml failed
> [file:///c:/sgml/files/uriIncl.xml] OK
> Content is Some other doc 
> [file://c:/sgml/files/uriIncl.xml] OK
> Content is Some other doc 
> [file:/c:/sgml/files/uriIncl.xml] OK
> Content is Some other doc 
> [file:///h:/uriIncl.xml] OK
> Content is Some other doc 
> file://h:/uriIncl.xml failed
> [file:/h:/uriIncl.xml] OK
> Content is Some other doc 
> file:/localhost/c:/sgml/files/uriIncl.xml failed 
> [file://localhost/c:/sgml/files/uriIncl.xml] OK Content is 
> Some other doc 
> file:///localhost/c:/sgml/files/uriIncl.xml failed 
> h:/uriIncl.xml failed 
> \\church\data3\users\dpawson\uriIncl.xml failed 
> //church/data3/users/dpawson/uriIncl.xml failed 
> [file:///h:/uriIncl.xml] OK Content is Some other doc 
> 
> 
> The stylesheet is:
> 
> <?xml version="1.0" encoding="utf-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>   xmlns:d="rnib.org.uk/tbs#"
>                 version="1.1">
> <d:doc >
>  <revhistory>
>    <purpose><para>Testing an external reference </para></purpose>
>    <revision>
>     <revnumber>1.0</revnumber>
>     <date>29 Apr 03</date>
>     <authorinitials>DaveP</authorinitials>
>     <revdescription>
>      <para>Initial</para>
>     </revdescription>
>     <revremark>-</revremark>
>    </revision>
>   </revhistory>
>   </d:doc>
>   
> 
>   <xsl:output method="html"/>
> 
> 
>   <d:forms>
>     <form>uriIncl.xml</form>
>     <form>file:/uriIncl.xml</form>
>     <form>file://uriIncl.xml</form>
>     <form>file:///uriIncl.xml</form>
>     <form>file:///c:/sgml/files/uriIncl.xml</form>
>     <form>file://c:/sgml/files/uriIncl.xml</form>
>     <form>file:/c:/sgml/files/uriIncl.xml</form>
>     <form>file:///h:/uriIncl.xml</form>
>     <form>file://h:/uriIncl.xml</form>   
>     <form>file:/h:/uriIncl.xml</form>
>     <form>file:/localhost/c:/sgml/files/uriIncl.xml</form>
>     <form>file://localhost/c:/sgml/files/uriIncl.xml</form>
>     <form>file:///localhost/c:/sgml/files/uriIncl.xml</form>
>     <form>h:/uriIncl.xml</form>
>     <form>\\church\data3\users\dpawson\uriIncl.xml</form>
>     <form>//church/data3/users/dpawson/uriIncl.xml</form>
>     <form>file:///h:/uriIncl.xml</form>
>   </d:forms>
> 
> 
>   <xsl:template match="/">
>     <html><head><title>Checking document()</title>  </head>
>     <body>
>       <h3>Test on file access</h3>
>       <p>
>     <xsl:for-each select="document('')//d:forms/form">
>        <xsl:call-template name="checkit">
>          <xsl:with-param name="form" select="."/>
>        </xsl:call-template>
>     </xsl:for-each>
>   </p>
>   </body>
> </html>
>   </xsl:template>
> 
> 
>   <xsl:template name="checkit">
>     <xsl:param name="form" />
>       <xsl:variable name="doc" select="document($form)"/>
>       
>     <xsl:choose >
>       <xsl:when test="$doc">
>         <i><xsl:value-of select="$form"/></i> OK<br />
>       Content is <xsl:value-of select="document($form)/ext"/><br />
>       </xsl:when>
>       <xsl:otherwise>
>         <i><xsl:value-of select="$form"/></i> failed<br />
>       </xsl:otherwise>
>     </xsl:choose>
>   </xsl:template>
> 
> 
> 
>   <xsl:template match="*">
>     *****<xsl:value-of select="name(..)"/>/<xsl:value-of
> select="name()"/>******
> </xsl:template>
> 
> 
> </xsl:stylesheet>
> 
> 
> Regards DaveP.
> 
> **** snip here *****
> 
> - 
> 
> NOTICE: The information contained in this email and any 
> attachments is 
> confidential and may be legally privileged. If you are not the 
> intended recipient you are hereby notified that you must not use, 
> disclose, distribute, copy, print or rely on this email's content. If 
> you are not the intended recipient, please notify the sender 
> immediately and then delete the email and any attachments from your 
> system.
> 
> RNIB has made strenuous efforts to ensure that emails and any 
> attachments generated by its staff are free from viruses. However, it 
> cannot accept any responsibility for any viruses which are 
> transmitted. We therefore recommend you scan all attachments.
> 
> Please note that the statements and views expressed in this email 
> and any attachments are those of the author and do not necessarily 
> represent those of RNIB.
> 
> RNIB Registered Charity Number: 226227
> 
> Website: http://www.rnib.org.uk 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread