[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Replacing character entities
Tempore 19:07:22, die 02/14/2005 AD, hinc in
xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Wagstaff, Jason
<WagstaffJ@xxxxxxxxxxxx>:
Hi,I have a text block that contains wherever the user wanted it to look like a paragraph break. I don't any have control over the input. Let's assume you have an XML with this node in it: <text>Line1 Line2 other content</text>
This can be achieved by applying a stylesheet like this: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes"/> <xsl:template match="text"> <div> <xsl:call-template name="par"/> </div> </xsl:template> <xsl:template name="par"> <xsl:param name="text" select="."/> <p> <xsl:value-of select="substring-before(concat($text,' '),' ')"/> </p> <xsl:if test="contains($text,' ')"> <xsl:call-template name="par"> <xsl:with-param name="text"> <xsl:value-of select="substring-after($text,' ')"/> </xsl:with-param> </xsl:call-template> </xsl:if> </xsl:template> </xsl:stylesheet>
|
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
|