[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] How to produce a record of changes made in an identity transform?
Subject: RE: [xsl] How to produce a record of changes made in an identity transform? From: "Michael Kay" <mhk@xxxxxxxxx> Date: Wed, 28 Jul 2004 12:43:31 +0100 |
xsl:result-document can't be used to append to an existing document. The result would depend on order of execution, which would impede the ability for optimizers to rearrange the code. You might find that you can achieve what you need using xsl:message. You'll need to check the details for your chosen XSLT processor to see how to capture the xsl:message output in a file. Saxon (with a bit of tweaking) is able to generate the xsl:message output in either XML or text form; by default it goes to the standard error output but you can change this programmatically. Michael Kay > -----Original Message----- > From: munna@xxxxxxxxxx [mailto:munna@xxxxxxxxxx] > Sent: 28 July 2004 12:14 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] How to produce a record of changes made in an > identity transform? > > Hello all, > I had posted this query yesterday, but realised that the > subject of the message didn't quite clarify my question, > hence this repost. Apologies to those who have already seen > this message. > Here's my problem: > I have the following stylesheet which essentially performs an > identity transform on a given xml instance, producing a copy with > only slight changes (the e.g. below has one of these -- > stripping out the concluding punctuation from element > 'onlyNum' -- but the actual stylesheet will have more). I > would like to produce another document that records these > changes, at least as a list containing the original and > changed node. this can be either text or xml, something on > the lines of: > <onlyNum>E345.</onlyNum> changed to > <onlyNum>E345</onlyNum> > I have a feeling this could be done with xsl:result-document, > but am not sure how to proceed. Any suggestions would be most > welcome. > > Thanks in advance, > > Munna > > ----------- > <xsl:stylesheet version="2.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > <xsl:output method="xml" indent="no" > omit-xml-declaration="yes"/> > > <xsl:template match="/|@*|node()"> > <xsl:copy> > <xsl:apply-templates select="@*|node()"/> > </xsl:copy> > </xsl:template> > > <xsl:template match="onlyNum"> > <onlyNum> > <xsl:analyze-string select="." > regex="^(\w+)(\s)*([.])(\s)*$" flags="m"> > <xsl:matching-substring> > <xsl:value-of select="regex-group(1)" /> > </xsl:matching-substring> > </xsl:analyze-string> > </onlyNum> > </xsl:template> > > </xsl:stylesheet> > > ---------------------------- > -- > ___________________________________________________________ > Sign-up for Ads Free at Mail.com > http://promo.mail.com/adsfreejump.htm
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to produce a record o, David Carlisle | Thread | Re: [xsl] How to produce a record o, Wendell Piez |
Re: [xsl] Converting a Batch File t, Garvin Franco | Date | Re: [xsl] DocBook to plain text - w, Paul DuBois |
Month |