Subject: | xslt parsing's wrong behaviour |
I came accross an error in transalation behaviour. The value of each <xsl:value-of /> markup is the same when using this module but the output is what I would expect using xsltproc. Here are the concerned files.
Using this style-sheet :
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/JOB">
#!/bin/sh
<!-- UserEmail est a Ajouter dans le code de bqs.pm -->
<xsl:if test="ATTR[@name='UserEmail']/@value" >
#PBS -mu <xsl:value-of select="ATTR[@name='UserEmail']/@value"/>
</xsl:if>
<xsl:if test="JOB/ATTR[@name='bqsQueueName']/@value" >
#PBS -q <xsl:value-of select="ATTR[@name='bqsQueueName']/@value"/>
</xsl:if>
<xsl:if test="ATTR[@name='bqsQueueMaxAllowedMemory']/@value" >
#PBS -l M=<xsl:value-of select="ATTR[@name='bqsQueueMaxAllowedMemory']/@value"/>
</xsl:if>
<xsl:if test="ATTR[@name='bqsQueueMaxCPUTime']/@value" >
#PBS -l T=<xsl:value-of select="ATTR[@name='bqsQueueMaxCPUTime']/@value"/>
</xsl:if>
<xsl:if test="ATTR[@name='bqsQueueMaxAllowedScratch']/@value" >
#PBS -l scratch=<xsl:value-of select="ATTR[@name='bqsQueueMaxAllowedScratch']/@value"/>
</xsl:if>
<xsl:if test="ATTR[@name='bqsQueueMaxCPUTime']/@value" >
#PBS -l platform=<xsl:value-of select="ATTR[@name='bqsQueueMaxCPUTime']/@value"/>
</xsl:if>
<!-- Cette ligne doit etre calculee en fonction de la conf de la VO en question : select="ATTR[@name
='localGroupName']/@value -->
#PBS -l LCG=
<xsl:if test="ATTR[@name='gridUserId']/@value">
#
# Grid User Id : '<xsl:value-of select="ATTR[@name='gridUserId']/@value"/>
#
</xsl:if>
</xsl:template>
<xsl:template match="ATTR[@name='bqsQueueName']" >
#PBS -PLOP <xsl:value-of select="@value"/>
</xsl:template>
</xsl:stylesheet>
-------------------
And this is my XML file to parse :
<JOB><ATTR name="bqsCluster" value="lcg"/><ATTR name="bqsQueueName" value="A"/><ATTR name="bqsQueueMaxAllowedMemory" value="512"/><ATTR name="bqsQueueMaxCPUTime" value="500"/><ATTR name="bqsQueueMaxAllowedScratch" value="1025"/><ATTR name="gridUserId" value="/O=GRID-FR/C=FR/O=CNRS/OU=CC-LYON/CN=Jonathan Schaeffer/Email=jonathan.schaeffer@cc.in2p3.fr"/><ATTR name="localUserName" value="dteam001"/><ATTR name="localGroupName" value="dteam"/><ATTR name="lcgJobId" value="https://lxn1177.cern.ch:9000/Np32JsWVPiHZLuiLIeSz2w"/><ATTR name="bqsJobId" value="lcg1128183347-18377"/><ATTR name="gassStdOutput" value="/home/dteam001/.globus/.gass_cache/local/md5/aa/b7a09a5666c76c007d134e19a9c058/md5/16/4ceb1467e9e3c9c3b65be40fd13e48/data"/><ATTR name="gassStdError" value="/home/dteam001/.globus/.gass_cache/local/md5/aa/b7a09a5666c76c007d134e19a9c058/md5/a4/8b0c777c6cf9303ecd791ec316042f/data"/><ATTR name="SubmissionDate" value="2005/11/28-18h33:47 "/><ATTR name="jobmonitorEntry" value="/opt/globus/tmp/gram_job_state/job.cclcgceli05.in2p3.fr.18347.1133199221"/><ATTR name="lastQuery" value="1133199240"/><ATTR name="jobStatus" value="QUEUED"/><ATTR name="gramState" value="1"/><ATTR name="UserEmail" value="jonathan.schaeffer@in2p3.fr"/></JOB>
The code which reproduces the bug :
use XML::XSLT;
my $xml_filename = "job.props";
my $xsl_filename = "bqsJobwrapper.xsl";
my $output_filename = "job.sh";
my $xslt = XML::XSLT->new($xsl_filename);
$xslt->transform ($xml_filename);
print $xslt->toString;