[xsl] XALAN does not handle document('') as expected to carry out an in-stylesheet look-up

Subject: [xsl] XALAN does not handle document('') as expected to carry out an in-stylesheet look-up
From: mark.clare@xxxxxxxxxxxx
Date: Thu, 1 Nov 2001 19:08:21 +0000
Hi

In order to sort items by date where we are provided with the date in dd
mmm yyyy format (e.g. 03 Jan 2001) I wanted to convert the MMM value to a
number which can be sorted.

I used the approach where I embedded a look-up within the stylesheet and
then used the document('') function to look up the month in the table to
get the number to sort by (see code segment below).

This works fine when I run XALAN from the command line.  However my
application applies the template after reading the XSL transform from a
database and then applying it to a document.  When this occurs XALAN
appears to be attempting to obtain a document from the file server when my
understanding was that the document('') function means that the lookup
table can be held within the stylesheet itself.

Does anyone know if this is a known feature or have I missed something
here?  Your help is appreciated.

Thanks

Mark Clare

 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version
="1.0" xmlns:m ="urn:non-null-namespace">
...................

<m:month name="Jan" value="1" />
<m:month name="Feb" value="2" />
<m:month name="Mar" value="3" />
<m:month name="Apr" value="4" />
<m:month name="May" value="5" />
<m:month name="Jun" value="6" />
<m:month name="Jul" value="7" />
<m:month name="Aug" value="8" />
<m:month name="Sep" value="9" />
<m:month name="Oct" value="10" />
<m:month name="Nov" value="11" />
<m:month name="Dec" value="12" />
................
.................

<xsl:sort order="ascending" select="substring(dateAdjusted,8,4)" />
<xsl:sort select="document('')/xsl:stylesheet/m:month
[@name=substring(current()/dateAdjusted,4,3)]/@value"
                  data-type="number" order="ascending"/>
<xsl:sort order="ascending" select="substring(dateAdjusted,1,2)" />








This e-mail message is CONFIDENTIAL and may contain legally privileged
information.  If you are not the intended recipient you should not  read,
copy, distribute, disclose or otherwise use the information in this e-mail.
Please also telephone or fax us immediately and delete the message from
your system.  E-mail may be susceptible to data corruption, interception
and unauthorised amendment, and we do not accept liability for any such
corruption, interception or amendment or the consequences thereof.


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


Current Thread