Need help with xsl replacing...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tytyguy
    New Member
    • Jun 2008
    • 2

    Need help with xsl replacing...

    Ok so I have an xml document that outputs
    <category>Sho es-Womens-Casual-Dress</category>

    I need to convert it to

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

    Is there a way to do this?
  • roces
    New Member
    • Jul 2008
    • 7

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

    Comment

    Working...