1
<Scheduled>
 <xsl:value-of select="//RequestParameters/Identifier/DepartureDate">
 </xsl:value-of>
 </Scheduled> 

In this xslt code iam getting a last character as 'z' in "//RequestParameters/Identifier/DepartureDate" i want to remove z and please help on this.

2 Answers 2

3

If the value of //RequestParameters/Identifier/DepartureDate contains 'z' only at the end, you can use substring-before function.

<xsl:value-of select="substring-before(//RequestParameters/Identifier/DepartureDate, 'z')">

edit:

If you want to get the first 10 characters of the value, you can use substring function.

<xsl:value-of select="substring(//RequestParameters/Identifier/DepartureDate, 1, 10)">
Sign up to request clarification or add additional context in comments.

2 Comments

thanks snak. Here DepartureDate is of type date for eg value is 2011-10-16T09:40:00.000Z but i need in output(preserve) only ten characters i.e 2011-10-16.Could you please help on this?
You can use substring function for the purpose. Updated the answer.
0

In general, you may want to convert an element value in ISO 8601 date format to another format by adding a javascript function to your xslt, and call that function in your Xpath expression. For instance, when you have added a (javascript) function convertToDate that extracts the date part of the input value in the format yyyymmdd, the Xpath expression

convertToDate (//RequestParameters/Identifier/DepartureDate)

will result in a value

20111016

assuming there is only one DepartureDate element in the input, having value

2011-10-16T09:40:00.000Z

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.