Subject: [xsl] Data-driven Display of records with variable number of fields From: "Rich Caloggero" <rjc@xxxxxxx> Date: Thu, 9 Dec 2004 16:05:37 -0500 |
Is this possible in xslt-1.0? Given the following input, I want to transform the output such that I get only the fields of each record which I specify in the headers element. I want the order to also be the order in which they appear in the headers element. So if headers looks like: <headers> <year/> <artist/> </headers> then I want each record in the output to only contain the year and artist fields, in that order. I can't seem to write an xPath expression for this kind of transform because xPath node tests cannot contain variables. The expression would need to look something like "/cds/cd/$field", where $field would contain the name of one of the nodes listen in /headers (see xml below). Thanx for any suggestions... -- Rich Input: <?xml version="1.0" encoding="ISO-8859-1" ?> <?xml-stylesheet type="text/xsl" href="transform.xsl"?><cds> <title>My CD Collection</title> <headers> <title/> <artist/> <year/> </headers> <cd> <artist>Rich Caloggero</artist> <title>A Taste of Tranquility</title> <year>2004</year> <label>Touch the Sky Music</label> </cd> <cd> <artist>The Grateful Dead</artist> <title>Europe 72</title> <year>1972</year> </cd> </cds> -- Rich "In the end, our society will be defined not only by what we create, but by what we refuse to destroy." -John C. Sawbill (1936-2000), president, The Nature Conservancy, 1990-2000
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] for-each does not iterate, Robert Soesemann | Thread | Re: [xsl] Data-driven Display of re, Wendell Piez |
Re: [xsl] <xsl:number> in XPath, António Mota | Date | Re: [xsl] <xsl:number> in XPath, António Mota |
Month |