Subject: RE: [xsl] select only some elements and attributes From: "Michael Kay" <mhkay@xxxxxxxxxxxx> Date: Thu, 15 Feb 2001 12:50:47 -0000 |
Write one template rule that copies and another that doesn't: <xsl:template match="...."> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="...."/> Then you can either list the elements you want copied in the first template rule, e.g. match="a|b|c", and write match="*" in the second; or do it the other way round, have the first template rule invoked by default and the second specify the elements you want excluded. Mike Kay > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Meili Zhong > Sent: 15 February 2001 00:55 > To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] select only some elements and attributes > > > Hi, What's the best way to only select some elements and > attributes using > xslt? For example, the xml source looks like: > > <product sku="123465-45"> > <title>Mutton and Rice Dog Food</title> > <description sku="2345-67">Everything needed for your pet's > health</description> > <price>25.99</price> > <available_date>2000-12-25</available_date> > <size>large</size> > <weight>40lbs</weight> > <vendor> > <company>Nutro Max</company> > <street>15 Industrial Blvd</street> > <city>Reno</city> > <state>NV</state> > <zip>56381</zip> > <phone>583 233-4598</phone> > </vendor> > </product> > > The output I want should be like: > > <product sku="123465-45"> > <title>Mutton and Rice Dog Food</title> > <price>25.99</price> > <weight>40lbs</weight> > <vendor> > <company>Nutro Max</company> > <phone>583 233-4598</phone> > </vendor> > </product> > > Thank you very much! > > Meili Zhong > > > 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] select only some elements, Jeni Tennison | Thread | [xsl] moving thru nodes, Rosa I-Ting Cheng |
RE: [xsl] French Book and Front Sof, Benoît BARRE | Date | RE: [xsl] moving thru nodes, Michael Kay |
Month |