I'm on my third XSLT conversion project. This time, I can't make any progress at all! I've stripped my files down to bare minimums...
First, my input XML to be parsed (myFile.xml):
Code:
<?xml version="1.0" encoding="UTF-8"?>
<TimeSeries xmlns="http://www.wldelft.nl/fews/PI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://fews.wldelft.nl/schemas/version1.0/pi-schemas/pi_timeseries.xsd" version="1.4">
<timeZone>0.0</timeZone>
<tzName>Universal Time</tzName>
</TimeSeries>
Now, my XSL stylesheet (PIXML2SHEF.xsl):
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet extension-element-prefixes="ex" xmlns:ex="http://exslt.org/dates-and-times" xmlns:ns1="http://fews.wldelft.nl/schemas/version1.0/pi-schemas/pi_timeseries.xsd" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/TimeSeries">
<xsl:variable select="timeZone" name="tz"/>
<xsl:value-of select="$tz"/>
<xsl:text>_________</xsl:text>
</xsl:template>
</xsl:stylesheet>
For reasons I cannot understand, The underscores do not print to the screen. Rather, what happens is the 0.0 and the "Universal Time" strings get printed to the screen, as if I had no XSL stylesheet at all. If I replace
Code:
match="/timeSeries"
with
then I get the underscores to print out, but the $tz variable is always empty (expecting 0.0). I cannot figure out what I am doing wrong. My command is:
Code:
cat myFile.xml | xsltproc -v PIXML2SHEF.xsl -
Any ideas?
Mark