[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: using substring-functions more than once in a node
Hello Thanx to David I can markup all my footnotes with the format (FN [1-9]) in my para-elements with an HTML anchor. <xsl:param name="replace" select="'(FN '"/> <xsl:template name="doFootnotes"> <xsl:param name="string"/> <xsl:choose> <xsl:when test="contains($string, $replace)"> <xsl:variable name="before"> <xsl:value-of select="substring-before($string, $replace)"/> </xsl:variable> <xsl:variable name="number"> <xsl:value-of select="substring(substring-after($string, $replace),1,1)"/> </xsl:variable> <xsl:variable name="after"> <xsl:value-of select="substring(substring-after($string, $replace),2)"/> </xsl:variable> <xsl:value-of select="$before"/> <xsl:value-of select="$replace"/> <a> <xsl:attribute name="href"> <xsl:text>#FN_</xsl:text> <xsl:value-of select="$number"/> </xsl:attribute> <xsl:value-of select="$number"/> </a> <xsl:call-template name="doFootnotes"> <xsl:with-param name="string" select="$after"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$string"/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="para"> <xsl:call-template name="doFootnotes"> <xsl:with-param name="string" select="."/> </xsl:call-template> </xsl:template> Now I ve got an additional problem to solve. I am now trying to markup footnotes with more than just one format, firstly the (FN 1-9) Footnotes and secondly footnotes that look like this *) where the *symbol can repeat up to nine times: *********) One way to solve this is to process the stylesheet more than once supplying another $replace parameter each time processing. E.g. in saxon: saxon source.xml replace.xsl replace=*****) This is a procedure I would like to avoid. So does anyone know how I can use this named template more than once replacing each time another string? Thanx in advance, Mario 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
|