|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: match string
Maybe I have found a solution. It works, at least with libxslt. is this correct? I think is is rather a hack. <!--Select the first paragraph of all chapters--> <xsl:template match="//chapter/section[1]/para[1]" priority="1"> <xsl:call-template name="first_line"> <xsl:with-param name="string" select="."/> </xsl:call-template> </xsl:template> <!--Select all other paragraphs--> <xsl:template match="//para"> <xsl:call-template name="para.template"> </xsl:call-template> </xsl:template> <xsl:template name="first_line"> <xsl:param name="string"/> <xsl:param name="string2"/> <xsl:param name="string3"/> <xsl:choose> <!--are there any spaces???--> <xsl:when test="contains($string, ' ')"> <div> <b> <!--1st word--> <xsl:value-of select="substring-before($string,' ')"/> <!--give back the space--> <xsl:text> </xsl:text> <!--2nd word--> <xsl:value-of select="substring-before( substring-after ($string, ' '), ' ')"/> <!--give back the space--> <xsl:text> </xsl:text> <!--3rd word--> <xsl:value-of select="substring-before( substring-after ( substring-after ($string, ' '), ' '),' ')"/> <!--give back the space--> <xsl:text> </xsl:text> </b> </div> </xsl:when> <xsl:otherwise> <xsl:call-template name="para.template"> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> On Oct 19, 2004, at 12:12 PM, Anton Triest wrote: Hmmm... just after posting, I realized it's probably safer to use "normalize-space(.)", to ignore any leading whitespace:
|
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








