Lookup elements and sort
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 11
- Joined: Sat Jan 14, 2006 7:17 pm
- Contact:
Lookup elements and sort
I'm having trouble finding the best way to go about solving for the following. I have an XML file which contains all of it's item level data in one location within an XML file. Everywhere else in the file, only a reference id is used.
Each time the <id> tag is used I need to perform a look up in the xml file to find all of the necessary information to finish my output. The assumption is that these <id> tags are in order, however if the items having a matching value in the <name> tag, all child nodes (other than the address) would need to be suppressed.
So my xml would look something like:
And my resulting XML should look like:
Note that the <name><address>(first address) and <theme> come from the initial element. The following elements only show address if the value of the <name> element are a match. This would repeat for a number of infinite ID's...
Best approach? These files will be pretty large.
Thanks in advance!
Each time the <id> tag is used I need to perform a look up in the xml file to find all of the necessary information to finish my output. The assumption is that these <id> tags are in order, however if the items having a matching value in the <name> tag, all child nodes (other than the address) would need to be suppressed.
So my xml would look something like:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<root>
<stores>
<store>
<name id="111" rate="20">Joe's</name>
<address>11 Smith St.</address>
<theme>Joe's stuff for sale</theme>
</store>
<store>
<name id="222" rate="14">Joe's</name>
<address>12 Bob St.</address>
<theme>Joe's stuff for sale</theme>
</store>
<store>
<name id="333" rate="16">Joe's</name>
<address>13 Nancy St.</address>
<theme>Joe's stuff for sale</theme>
</store>
<store>
<name id="444" rate="18">Joe's</name>
<address>14 George Way</address>
<theme>Joe's stuff for sale</theme>
</store>
</stores>
<places>
<store>
<id>333</id>
</store>
<store>
<id>111</id>
</store>
</places>
</root>
Code: Select all
<root>
<stores>
<store>
<name>Joe's</name>
<address>11 Smith St.<rate>20</rate></address>
<address>14 George Way<rate>18</rate></address>
<address>13 Nancy St.<rate>16</rate></address>
<address>12 Bob St.<rate>14</rate></address>
<theme>Joe's stuff for sale</theme>
</store>
</stores>
</root>
Best approach? These files will be pretty large.
Thanks in advance!
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service