[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Basic template matching issues - I think?

Subject: [xsl] Basic template matching issues - I think?
From: An OldBloke <neil_owens@xxxxxxxxxxx>
Date: Tue, 20 Nov 2012 12:28:19 +0000

I'm getting the following error trying to integrate regex into a transform
that previously used concat and string searching as it's much more flexible.

The error is:-

C:\>java -jar saxon9he.jar -o Result.xml text.xml regextime.xslt

Error on line 22 column 5 of regextime.xslt:
  SXXP0003: Error reported by XML parser: The value of attribute "select"
associated with an
  element type "null" must not contain the '<' character.
Failed to compile stylesheet. 1 error detected.

I just can't see what I've done wrong, so am hoping you kind folks can put me
on the (x)path again.

XML file:
<Log Device="SERVER1">
<myCommand Command="test" Time="12/11/2012 11:12:04 AM" Port="9999"

xsl Transform:
<?xml version="1.0"?>
<xsl:stylesheet version="2.0"
<xsl:output method="xml" indent="yes" name="TextFormat"

<xsl:template match="Log">
    <xsl:apply-templates select="myCommand"/>

<xsl:template match="myCommand">
        <xsl:element name="Command"><xsl:value-of
        <xsl:template match="Time">
        <xsl:analyze-string select="@Time" regex="(\d{2})\/(\d{2})\/(\d{4})
                <xsl:value-of select="concat(string(number(regex-group(3))),
                                 string(number(regex-group(2))), '-',
                                 string(number(regex-group(1))), 'T',
                                 format-number(regex-group(4), '00'), ':',
                                 regex-group(5), ':',
                                 regex-group(6) />
        <xsl:element name="Port"><xsl:value-of select="@Port"/></xsl:element>

Current Thread