Mike Gerwitz

Activist for User Freedom

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <gerwitm@lovullo.com>2015-04-14 12:12:57 -0400
committerMike Gerwitz <gerwitm@lovullo.com>2015-04-14 12:12:57 -0400
commit530407e05dafaa0ace9936bb3b3a3b2b7f8c60f1 (patch)
tree17bab5d93eddd4927b5b21b7c594c902d2f758e4
parent5cded3d64bec3c0c2b42b67169aa27cf5810bc50 (diff)
downloadliterate-xsl-530407e05dafaa0ace9936bb3b3a3b2b7f8c60f1.tar.gz
literate-xsl-530407e05dafaa0ace9936bb3b3a3b2b7f8c60f1.tar.bz2
literate-xsl-530407e05dafaa0ace9936bb3b3a3b2b7f8c60f1.zip
Attribute selectors now escaped in @match output
-rw-r--r--src/xsltexi.xsl27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/xsltexi.xsl b/src/xsltexi.xsl
index ab007e4..c81965f 100644
--- a/src/xsltexi.xsl
+++ b/src/xsltexi.xsl
@@ -66,7 +66,7 @@
<value-of select="concat(
$xt:nl,
'@deffn match {', @mode, '} ',
- ' on {', @match, '}',
+ ' on {', xt:escape-match( @match ), '}',
$xt:nl,
$doc,
$xt:nl,
@@ -75,6 +75,31 @@
</template>
+
+<!--
+ Escape `at' symbols in matches.
+
+ These are common in XPath queries (attribute selectors), but
+ conflict with the Texinfo command prefix.
+-->
+<function name="xt:escape-match" as="xs:string">
+ <param name="match" as="xs:string" />
+
+ <variable name="preat" as="xs:string"
+ select="substring-before( $match, '@' )" />
+ <variable name="postat" as="xs:string"
+ select="substring-after( $match, '@' )" />
+
+ <sequence select="if ( $preat ) then
+ concat(
+ $preat,
+ '@@',
+ xt:escape-match( $postat ) )
+ else
+ $match" />
+</function>
+
+
<!--
Generate `template' and `function' definitions