Reputation: 2084
In my XML File I have as the following :
<From year="2013" month="--01" day="---04"/>
In My XSLT File I want to display the values of these attributes, so I will have something like this in the output :
04/01/2013
But instead of this, I have this :
---01/--04/2013
This is what I wrote in my XSLT file :
<xsl:value-of select="Period/To/@day" />/<xsl:value-of select="Period/To/@month" />/<xsl:value-of select="Period/To/@year" />
How can I solve this ?
Upvotes: 0
Views: 36
Reputation: 11416
You could use translate()
to remove the-
:
<xsl:value-of select="translate(Period/To/@day,'-','')" />/
<xsl:value-of select="translate(Period/To/@month,'-','')" />/
<xsl:value-of select="Period/To/@year" />
Result:
04/01/2013
translate(value, '-','')
just translates/replaces every occurence of -
with nothing.
For reference: https://developer.mozilla.org/en-US/docs/Web/XPath/Functions/translate
Upvotes: 2