xsl-list
[Top] [All Lists]

Re: [xsl] Using xsl:variable and replace() to remove specific characters.

2008-04-29 04:13:34
Thankyou to everyone who replied to me. Sorry for my silence; I was having 
some difficulties posting to the list.

It looks like a template matching on aff/text() will be the best approach 
for me. It never occurred to me to write a template to match the text() 
nodes only.

 In general stripping certain types of punctuation from the end of a 
text() node is going to be the correct thing to do, although there will 
still be exceptions; I will still have a problem with something like this:

<aff id="aj267072af4"><label>4</label>European Space Agency, 
<italic>XMM</italic>-<italic>Newton</italic> Science Operations Centre, 
European Space Astronomy Centre, Apartado 50727, Villafranca del Castillo, 
28080 Madrid, Spain</aff>

... where the comma following 'Agency' is going to be lost. However what I 
have working already is a great improvement on the previous state of 
affairs.

And here is the rationale for why I would want to strip this punctuation 
at all:

The xml I'm working with is used as the source for pdf, xml & html end 
products. Unfortunately during the production of the new xml, it's 
required that the e-mail addresses held in the <ext-link> elements are 
stripped out. This means that semi-colons, commas and other punctuation is 
then left behind and this looks especially bad when you have multiple 
e-mail addressed separated by commas. My personal opinion is that this 
punctuation should not be present in the xml and that the processes that 
create the pdf & html should be adjusted to insert the punctuation where 
required based on the structure of the xml, however that is not within my 
sphere of influence... 

Regards

Richard



-----Original Message-----
From: Richard Corfield [mailto:richard(_dot_)corfield(_at_)iop(_dot_)org] 
Sent: 28 April 2008 10:26
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Using xsl:variable and replace() to remove 
specific characters.

What I'm trying to do is process some xml of which this is a fragment:

<aff id="aj266199af2">
  <label>2</label>National Radio Astronomy Observatory, 
Chile<xref ref-type="fn" 
rid="aj266199afn4"><sup>9</sup></xref>; <ext-link 
ext-link-type="email" id="aj266199em4">email address 
here</ext-link> </aff>

<!-- snip -->
<fn id="aj266199afn4">
  <label>9</label>
  <p>The National Radio Astronomy Observatory is a facility 
of the National Science Foundation operated under cooperative 
agreement by Associated Universities, Inc.
  </p>
</fn>


The problem is the trailing semi-colon between the <xref> & 
<ext-link> elements.


************************************************************************
This email (and attachments) are confidential and intended for the addressee(s) 
only. If you are not the intended recipient please notify the sender, delete 
any copies and do not take action in reliance on it. Any views expressed are 
the author's and do not represent those of IOP, except where specifically 
stated. IOP takes reasonable precautions to protect against viruses but accepts 
no responsibility for loss or damage arising from virus infection. For the 
protection of IOP's systems and staff emails are scanned automatically.

IOP Publishing Limited Registered in England under Registration No 467514. 
Registered Office: Dirac House, Temple Back, Bristol BS1 6BE England
Vat No GB 461 6000 84.

Please consider the environment before printing this e-mail



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--