xsl-list
[Top] [All Lists]

RE: Problem with document() function on web server

2005-07-11 07:05:50
The stylesheets are executed server side, and the web server is configured
by someone else. 

What parameters in the server configuration should I check? Is it possible
to restrict namespace declarations or references to external XML documents?

FYI, this is the complete template. In my attempt to be brief, I
accidentally omitted the definition of the month variable.

        <xsl:template name="FrenchDate">
                <xsl:variable name="year" select="substring-before(.,
'-')"/>
                <xsl:variable name="month" select="substring(.,6,2)"/>
                <xsl:variable name="day" select="substring(.,9,2)"/>
                <xsl:value-of select="$day"/>
                <xsl:text> </xsl:text>
                <xsl:value-of
select="document('')/*/fr:month-names/fr:month[(_at_)num=$month]"/>
                <xsl:text> </xsl:text>
                <xsl:value-of select="$year"/>
        </xsl:template>


Maria



-----Original Message-----
From: Geert Josten [mailto:Geert(_dot_)Josten(_at_)daidalos(_dot_)nl] 
Sent: Monday, July 11, 2005 9:52 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Problem with document() function on web server

Hi Maria,

I tried two different versions of the document() function to format dates.
Both versions worked on my local hard drive but not on the web server. 
I know that I have a more recent version of Xalan on my hard drive, 
but I am wondering if something else is causing the problem.
 
This version of the template, in which the monthnames were stored in 
separate namespace, caused the stylesheet to stop transforming.
 
 <fr:month-names>
  <fr:month num="01">jan</fr:month>
  <fr:month num="02">f&#233;v</fr:month>
  <fr:month num="03">mar</fr:month>
 </fr:month-names>
 
 <xsl:template name="FrenchMonth">
  <xsl:value-of
select="document('')/*/fr:month-names/fr:month[(_at_)num=$month]"/>
 </xsl:template>

I assume you are being brief here, but just to be sure: where do you define
the variable month?

This version of the template, in which the monthnames were stored in 
an external XML file, returned a null value.
 
<MonthNames>
 <French>
  <Name num="01">jan</Name>
  <Name num="02">f&#233;v</Name>
  <Name num="03">mar</Name>
 </French>
</MonthNames>
 
 <xsl:variable name="FrenchMonth"
select="document('month_names.xml')/MonthNames/French"/>
 <xsl:template name="FrenchMonth">
  <xsl:value-of select="$FrenchMonth/Name[(_at_)num=$month]"/>
 </xsl:template>

I think you can better add a namespace to the external file as well.

For the remainder, I would say that things depend on how you configured your
web server and how you execute the stylesheet. Do you execute them
server-side?

HTH,
Geert

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>