date:add XLST template
"John Watson" <[email protected]>
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <[email protected]> |
A newby question. I'm having difficulty understanding
date.add.template.xsl. The following stylesheet (usable against any
arbitrary XML target) indicates my problem. The sections labeled 'ok'
work as I would expect, but those labeled 'notok' seem to introduce an
intrusive minus sign in the time portion of the returned date/time. Am I
missing something fundamental, or is there a bug in the style sheet if
manipulation of times is required? Any help gratefully accepted.
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version
= "1.0"
xmlns:lxslt="http://xml.apache.org/xslt"
xmlns:date="http://exslt.org/dates-and-times"
exclude-result-prefixes = "lxslt date"
>
<xsl:output indent="yes"/>
<xsl:include href = "date.add.template.xsl" />
<!-- default rule is to ignore all elements with no explicit rule -->
<xsl:template match='node()'>
</xsl:template>
<!-- the root element -->
<xsl:template match="/">
<results>
<ok>
<xsl:call-template name="date:add">
<!-- OK -->
<xsl:with-param name = "date-time" select =
"'2006-02-18T14:01:00'" />
<xsl:with-param name = "duration" select = "'-PT10H'" />
</xsl:call-template>
</ok>
<ok>
<xsl:call-template name="date:add">
<!-- OK -->
<xsl:with-param name = "date-time" select =
"'2006-02-18T14:01:00'" />
<xsl:with-param name = "duration" select = "'-PT601M'" />
</xsl:call-template>
</ok>
<notok>
<xsl:call-template name="date:add">
<!-- produces 2006-02-18T04:-59:00 -->
<xsl:with-param name = "date-time" select =
"'2006-02-18T14:01:00'" />
<xsl:with-param name = "duration" select = "'-PT600M'" />
</xsl:call-template>
</notok>
<notok>
<xsl:call-template name="date:add">
<!-- produces 2006-02-18T03:-29:00 -->
<xsl:with-param name = "date-time" select =
"'2006-02-18T14:01:00'" />
<xsl:with-param name = "duration" select = "'-PT10H30M'" />
</xsl:call-template>
</notok>
<notok>
<xsl:call-template name="date:add">
<!-- produces 2006-02-18T03:-29:00 -->
<xsl:with-param name = "date-time" select =
"'2006-02-18T14:01:00'" />
<xsl:with-param name = "duration" select = "'-PT630M'" />
</xsl:call-template>
</notok>
</results>
</xsl:template>
</xsl:stylesheet>
*************************************************************
Satellite Information Services Limited Registered Office:
17 Corsham Street London N1 6DR, Company No. 4243307
The information in this e-mail (which includes any files
transmitted with it) is confidential and is intended for the
addressee only. Unauthorised recipients are required to
maintain confidentiality. If you have received this e-mail
in error please notify the sender immediately, destroy any
copies and delete it from your computer system.
*************************************************************
_______________________________________________
exslt mailing list
[email protected]
http://www.exslt.org/list