RE: [xsl] Retrieving "markup" hidden in comments

Subject: RE: [xsl] Retrieving "markup" hidden in comments
From: AAS Contractor <AAS.Contractor@xxxxxxx>
Date: Fri, 29 Jun 2007 13:19:13 +0100
Thanks to both Mike and Abel for providing the answer. That extension had 
passed me by. I think such a function could be a useful addition to the 



"Michael Kay" <mike@xxxxxxxxxxxx> 
28/06/2007 16:50
Please respond to


RE: [xsl] Retrieving "markup" hidden in comments

The saxon:parse() extension function allows you to extract the content of
the comment and parse it as if it were an XML document.

Michael Kay

> -----Original Message-----
> From: AAS Contractor [mailto:AAS.Contractor@xxxxxxx] 
> Sent: 28 June 2007 16:38
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Retrieving "markup" hidden in comments
> Hi,
> I'm using XSLT 2.0 with Saxon 8B.
> My problem is:
> I have xml files which contain Arbortext Math markup which 
> has been placed 
> in comments, e.g. 
> <!--<FORMULA><F>-21.6&amp;lt;M<INF>V</INF>&amp;lt;-14.9</F></F
> ORMULA>-->
> The reason being that the math markup is not valid according 
> to the DTD being used. I have no control over this. However, 
> I want to be able to process this "hidden" markup as if it 
> were real elements.
> I can retrieve the comment text string, but of course that's 
> all it is - a 
> string. Is there any way to coerce that into being treated as 
> an element or document-node? I can achieve the effect I want 
> by writing the content of each comment out to a file (using a 
> character map or
> disable-output-escaping) and read them in again on a second 
> pass. This works, but is rather messy, and I'd rather do it 
> in one pass.
> Is there a way to emulate the effect of document() but on the 
> content of a 
> variable rather than a file? Other than that, I guess the 
> other option is to write a parser for the math markup in 
> xslt, which I'd rather not have to do :-(
> Thanks for any suggestions.
> Regards,
> Bruce
> **************************************************************
> **********
> 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.

Current Thread