[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Changing text "in place"

Subject: Re: Changing text "in place"
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 4 May 1999 10:29:29 +0100 (BST)
latex catcode

> I have a problem
> to get some characters that are "special" for LaTeX into a form that is
> acceptable (e.g., $, %, #, &, etc. have a special meaning). So the easiest
> would be to escape such characters when they get transferred

Actually for machine generated latex there is not really a lot of point
in leaving those with special meanings. I would just make all of those
normal letters in latex (ie \catcode`\$=12 etc) and not bother messing
around quoting stuff. Similarly

>  to the result tree, _if necessary_. The latter is important, since
> inside verbatim-like environments the characters can be used as-is, 

There is certainly no need to use verbatim environments for machine
generated latex. They are a minor aid to authoring but complicate
latex greatly and in this situation you just need to switch to
a monospaced font, you don't need to change all of latex's parsing


> Before I go off and write a set
> of Java routines using xt's extension mechanism, 

You can do string replacements just in XSLT without relying on

to change $ to \$ and % to \% and # to \#


<xsl:import href="http://andover.nag.co.uk/~davidc/verb.xsl"/>

<xsl:template match="/">
  <xsl:call-template name="string-replace">
    <xsl:param name="to" expr="'\$'"/>
    <xsl:param name="from" expr="'$'"/> 
    <xsl:param name="string">
      <xsl:call-template name="string-replace">
        <xsl:param name="to" expr="'\%'"/>
        <xsl:param name="from" expr="'%'"/> 
        <xsl:param name="string">
          <xsl:call-template name="string-replace">
            <xsl:param name="to" expr="'\#'"/>
            <xsl:param name="from" expr="'#'"/> 
            <xsl:param name="string" expr="."/>


would convert 

hello world (%) (#) ($)


hello world (\%) (\#) (\$)


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.