Re: can XML-XSL do what Lisp and s-expressions do?

Subject: Re: can XML-XSL do what Lisp and s-expressions do?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 26 Jan 2000 17:22:38 GMT
> what is the easiest way to strip ampersands from xml code using xsl ?

it depends what you mean. If you mean ampersand characters in the
character data of a text node, then you just need to use

select="translate(.,'&amp;','')"

where . in the first argument means the text of the current node, could
be any xpath expression.

If you mean stripping off ampersands in the concrete markup in an xml
file then basically you can't as & is th eentity reference start
character and the XML parser will expand the entities before passing the
input to the XSL system.

So if you have
<test>
 this &amp; that
</test>

the first will give you " this  that" if you want  this amp; that then
in this case you could do it as you just need to replace all ampersands by
`amp;' but in general you can't as there is no record that there was an
entity reference in the input tree, so except for entities pointing at
single characters you are stuck.

David


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


Current Thread