|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Urgent..please advise
Try the
stylesheet below,
I didn't execute
it so you might have to debug it a little !
But the concepts
are shown ...
you might also
try to extract the variables this way :
<xsl:variable name='y'
expr='string(./YEAR)'/>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"> <xsl:template match="//DATETIME[@QUALIFIER='CREATION']"> <xsl:variable name='y'
expr='./YEAR/text()'/>
<xsl:variable name='m' expr='./DAY/text()'/> <xsl:variable name='d' expr='./DAY/text()'/> <xsl:variable name='h' expr='./HOUR/text()'/> <xsl:variable name='min' expr='./MINUTE/text()'/> <xsl:variable name='sec' expr='./SECOND/text()'/> <!-- <xsl:variable name='subsec' expr='./SUBSECOND/text()'/> <xsl:variable name='subsec' expr='./TIMEZONE/text()'/> <xsl:variable name='tz' expr='./TIMEZONE/text()'/> -->
<CREATION_DATE><xsl:value-of select='$y'/>/<xsl:value-of
select='$m'/>/<xsl:value-of select='$d'/>
<xsl:value-of select='$h'/>:<xsl:value-of select='$min'/>:<xsl:value-of select='$sec'/> <CREATION_DATE> </xsl:template>
<!-- A template that copies "as
is", that's what will leave the rest of the
tree unchanged :
notice that a priority of -1 is
assigned, since if conflicts with the template above, and
we want this one to have lesser
priority ...
-->
<xsl:template
match="*|@*|comment()|pi()|text()" priority="-1"
name="identity">
<xsl:copy> <xsl:apply-templates select="*|@*|comment()|pi()|text()"/> </xsl:copy> </xsl:template> </xsl:stylesheet>
If you want to
deal with other 'qualifiers' you can do :
<xsl:template
match="//DATETIME">
<xsl:variable name='qualifier' expr='@QUALIFIER'/> <xsl:chose>
<xsl:when
test='$qualifier="CREATION"'>
do something
</xsl:when>
<xsl:when test='$qualifier="SOMETHING_ELSE"'>
do something else ...
</xsl:when>
</xsl:chose>
Maxime Levesque
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








