Data-driven Display of records with variable number of
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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format