Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

Need help with xsl replacing...

Question posted by: tytyguy (Newbie) on July 10th, 2008 06:17 PM
Ok so I have an xml document that outputs
<category>Shoes-Womens-Casual-Dress</category>

I need to convert it to

<category>/Womens/Casual/Dress</category>

Is there a way to do this?
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
roces's Avatar
roces
Newbie
7 Posts
July 11th, 2008
10:06 AM
#2

Re: Need help with xsl replacing...
Code: ( text )
  1. <xsl:template match="category">
  2.    <xsl:copy>
  3.       <xsl:value-of select="translate(text(), '-', '/')"/>
  4.    </xsl:copy>
  5. </xsl:template>


And if you need to remove first folder than:
Code: ( text )
  1. <xsl:template match="category">
  2.    <xsl:copy>
  3.       <xsl:value-of select="translate(substring-after(text(), '-'), '-', '/')"/>
  4.    </xsl:copy>
  5. </xsl:template>

Reply
Reply
Not the answer you were looking for? Post your question . . .
182,532 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top XML Forum Contributors