xslt 2.0 how replace $ by escaped dollar (for conversion to LaTeX) -
i new xslt. googled extensively couldn't figure out how following:
i transforming xml latex. of course, latex needs escape characters such $ , #. tried following in replace function not work. (they work without replace function.)
<xsl:template match="xyz:doc"> \subsubsection{<xsl:value-of select="replace( xyz:headline, '(\$)', '\$1' )"/>} ... </xsl:template> <xsl:template match="xyz:doc"> \subsubsection{<xsl:value-of select="replace( xyz:headline, '\$', '\$' )"/>} ... </xsl:template>
possible content escaped is: "locally defined field #931" or "locally defined subfield $b"
what doing wrong? many answers!
if want replace dollar symbol $
in input \$
in output use replace(xyz:headline, '\$', '\\\$')
.
if there several characters need same escaping replace(xyz:headline, '([$#])', '\\$1')
should do.
sample @ http://xsltransform.net/bdxtqx/1
Comments
Post a Comment