|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: String Manipulation in XSL
Using this xml <?xml version="1.0" ?> <test>http://www.dpawson.co.uk/xsl/sect2/N7240.html#d201e246 </test> And this stylesheet <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/test"> <html> <head></head> <body> <xsl:call-template name="chop"> <xsl:with-param name="txt" select="." /> </xsl:call-template> </body> </html> </xsl:template> <xsl:template name="chop"> <xsl:param name="txt" /> <xsl:choose> <xsl:when test="string-length($txt) > 20"> <xsl:text /><xsl:value-of select="substring($txt, 1, 20)" /><xsl:text> </xsl:text> <xsl:call-template name="chop"> <xsl:with-param name="txt" select="substring($txt, 20)" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:text /><xsl:value-of select="$txt" /> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet> You should get what you need. Ciao Chris XML/XSL Portal http://www.bayes.co.uk/xml XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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








