Re: [xsl] Building cross-referenced texts with XSLT

Subject: Re: [xsl] Building cross-referenced texts with XSLT
From: Aaron Optimizer Digulla <digulla@xxxxxxxx>
Date: Mon, 26 Aug 2002 19:34:56 +0200
On Sun, Aug 25, 2002 at 04:44:49PM -0400, G. Ken Holman wrote:

> At 2002-08-25 20:56 +0200, Aaron Optimizer Digulla wrote:
> >How can I write a script that converts "Lady Asano" into &LadyAsano;
> >and "Nagao" into &Nagao; but which leaves &Nagao; (or the expanded
> >entity) alone?
> 
> By not using XSLT.
> 
> An XSLT stylesheet does not manipulate markup, it manipulates node 
> trees.  The XSLT processor reads the input markup and delivers node trees 
> to the stylesheet and then takes the resulting node tree built by the 
> stylesheet to create the output markup if so requested.
> 
> This means that entities and the manipulation of markup syntax is outside 
> of the control of the stylesheet.
> 
> I hope this helps the understanding, though I realize it means you won't 
> have an answer to your question.
> 
> ................... Ken

Actually, I found a solution but it's three-step:

1. I create a 1:1 copy XSL which adds <REPLACE> elements around the
parts where replacement should take place.

2. I run that though a simple Python programm which ignores
anything outside of <REPLACE> elements and adds the new
stuff.

3. Then I run the output again through a script which
compresses the expanded entities again.

This way, I can use the knowledge about structured content from the
XSL tool plus the power of regexps without having either applied at
the wrong place.

There is no way to tell xsltproc to leave the entities alone, I guess?
That would allow me to skip step#3 - just a nice to have.

Sometimes, all it needs is to explain the problem to someone.

Thanks!

-- 
==============================================
Sowatec AG,       CH-8330 Pfäffikon (ZH)
Witzbergstr. 7,   http://www.sowatec.com
Tel: +41-(0)1-952 55 55
Fax: +41-(0)1-952 55 66
----------------------------------------------
Aaron "Optimizer" Digulla, digulla@xxxxxxxxxxx
==============================================

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


Current Thread