[xsl] EXSLT extension function

Subject: [xsl] EXSLT extension function
From: Chris Loschen <closchen@xxxxxxxxxxxxxxxxxx>
Date: Fri, 30 Jul 2004 17:22:57 -0400
Hi again everybody!

I haven't seen my question on the list yet, but I did manage to figure it out with some more
Google searching. The syntax should have been like this instead:

<xsl:variable name="time">
<xsl:variable name="hours" select="format-number(date:hour-in-day(),'00')"/>
<xsl:variable name="minutes" select="format-number(date:minute-in-hour(),'00')"/>
<xsl:value-of select="concat($hours,$minutes)"/>

Now I'm running into another problem, this time with xalan:write. Here's the situation: I have a very large
file which I need to parse piece by piece, so I'm looping through <BillHeader> and <Bill> (many times)
and finally <BillTrailer> elements. In each case, the XSLT is run on a single <BillHeader>, <Bill>, or
<BillTrailer> rather than on the entire XML document, which could be several hundred megabytes. So far,
so good, but as it turns out, the <BillTrailer> output needs to replicate most of what's in the <BillHeader>
output. The solution I'm trying to use is to write out the <BillHeader> normally, but also to an XML document
which can then get called back in when we get to the <BillTrailer>.

The file is getting written out more or less as expected, and has the good data, but then the later process
can't find the file again. The cause appears to be that my filesystem has spaces in the names (d--n that
Windows!) so the file isn't getting written out to c:\Documents and Settings\ etc. but to c:\Documents%20and%20Settings
etc. -- I have a complete tree built up on my C drive with all of the spaces replaced with %20s. Then the
later process looks in the current directory and the file isn't there.

So, I think I understand what's happening, but I don't have a way around it -- any suggestions out there? Thanks!

To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: EXSLT extension function

Hi everybody!

I'm trying to pull in the system time (I'll want the date as well, but one thing at a time...)
to my XSLT stylesheet. It looked like the EXSLT functions had just what I need, and
they're supposedly supported by my XSLT processor (Xalan-J 2.6). But I'm getting this

javax.xml.transform.TransformerException: ElemTemplateElement error: date:hour-in-day

I might have the namespace wrong or perhaps I'm not calling the extension function
correctly? I've done a Google search without finding anything. Anybody have any
ideas? Thanks!

Here is a fragment of the stylesheet (I know it's not well-formed -- I'm just copying the relevant section):

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"

<xsl:output method="xml" version="1.0" omit-xml-declaration="yes" indent="yes" />

<xsl:template match="BillHeader">
        <xsl:variable name="time">
                <xsl:variable name="hours">
                        <xsl:call-template name="date:hour-in-day"/>
                <xsl:variable name="minutes">
                        <xsl:call-template name="date:minute-in-hour"/>
                <xsl:value-of select="concat($hours,$minutes)"/>



Chris Loschen
781-718-3017 (cell)


Chris Loschen
781-718-3017 (cell)

Current Thread