- From: Hugo Haas via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 18 Nov 2005 17:05:18 +0000
- To: public-ws-desc-eds@w3.org
Update of /sources/public/2002/ws/desc/wsdl20
In directory homer:/tmp/cvs-serv6182
Modified Files:
xmlspec2latex.xsl
Log Message:
Escaping # in links
Index: xmlspec2latex.xsl
===================================================================
RCS file: /sources/public/2002/ws/desc/wsdl20/xmlspec2latex.xsl,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** xmlspec2latex.xsl 1 Aug 2005 11:39:41 -0000 1.6
--- xmlspec2latex.xsl 18 Nov 2005 17:05:16 -0000 1.7
***************
*** 208,217 ****
<!-- loc: a Web location -->
<!-- outside the header, it's a normal cross-reference -->
<xsl:template match="loc">
<xsl:text>\href{</xsl:text>
<xsl:value-of select="@href" />
<xsl:text>}{</xsl:text>
! <xsl:value-of select="." />
! <xsl:text>}</xsl:text>
</xsl:template>
--- 208,248 ----
<!-- loc: a Web location -->
<!-- outside the header, it's a normal cross-reference -->
+ <!-- reusable replace-string function from http://aspn.activestate.com/ASPN/Cookbook/XSLT/Recipe/65426 by Paul Prescod -->
+ <xsl:template name="replace-string">
+ <xsl:param name="text"/>
+ <xsl:param name="from"/>
+ <xsl:param name="to"/>
+
+ <xsl:choose>
+ <xsl:when test="contains($text, $from)">
+
+ <xsl:variable name="before" select="substring-before($text, $from)"/>
+ <xsl:variable name="after" select="substring-after($text, $from)"/>
+ <xsl:variable name="prefix" select="concat($before, $to)"/>
+
+ <xsl:value-of select="$before"/>
+ <xsl:value-of select="$to"/>
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="text" select="$after"/>
+ <xsl:with-param name="from" select="$from"/>
+ <xsl:with-param name="to" select="$to"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$text"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
<xsl:template match="loc">
<xsl:text>\href{</xsl:text>
<xsl:value-of select="@href" />
<xsl:text>}{</xsl:text>
! <xsl:call-template name="replace-string">
! <xsl:with-param name="text" select="."/>
! <xsl:with-param name="from" select="'#'"/>
! <xsl:with-param name="to" select="'\#'"/>
! </xsl:call-template>
! <xsl:text>}</xsl:text>
</xsl:template>
Received on Friday, 18 November 2005 17:05:30 UTC