Subject: RE: [xsl] transform only a section of xml From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Mon, 11 Nov 2002 17:24:32 -0000 |
> I am sure this is a FAQ but I am not sure how to ask this > question properly without illustrating it. I would like to > transform only a portion of an xml document while mainting > the rest of the structure. Write the identity template rule as the default rule for all elements: <xsl:template match="*"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> and then supplement it with rules for the elements you want to modify: <xsl:template match="form"> ... </xsl:template> Michael Kay Software AG home: Michael.H.Kay@xxxxxxxxxxxx work: Michael.Kay@xxxxxxxxxxxxxx > > <!-- original --> > <xml> > <section> > <title>title</title> > <para> > <form id="1"/> <!-- item to transform --> > </para> > </section> > </xml> > > <!-- transform to --> > <xml> > <section> > <title>title</title> > <para> > <form method="post"> > <input type="text" name="NAME" /> > </form> > </para> > </section> > </xml> > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] transform only a section , David Carlisle | Thread | RE: [xsl] transform only a section , Ben Robb |
RE: [xsl] transform only a section , Ben Robb | Date | RE: [xsl] Transform in-memory XML d, John Aschenbrenner |
Month |