|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSLT2 node comparison, wordlists
On 10/24/07, Michael Kay <mike@xxxxxxxxxxxx> wrote: > > Nice to see you back, James. I like to stick my head above the lurking parapet occasionally ;-) > It's not easy, actually! Oh good. That is reassuring. I did think I was just missing something obvious. I implemented something which worked perfectly that was a combination between your suggestion and Ken's, and used xsl:result-document to stick the linkGrps in another file. So thanks to you both! If all the people on this list that have helped me over the years decided to collect on the number of beers I must owe them my local would run dry. ;-) Of course, what I'm wondering now is the most efficient way to pull out the first value from the correct document('linkGrps.xml')linkGrp/link/@target when processing the text in question so as to make links from it, to the entry in the wordlist file. Basically, say the XML in file.xml looks like: ==== <div> <l> <seg xml:id="w1">This</seg> <seg xml:id="w2">is</seg> <seg xml:id="w3">a</seg> <seg xml:id="w4">test</seg>. </l> </div> ==== and linkGrps.xml looks like: ==== <div> <linkGrp> <link targets="wordlist.xml#let1-w1-vA file.xml#w3"/> </linkGrp> <linkGrp> <link targets="wordlist.xml#let8-w17-vB file.xml#w2"/> </linkGrp> <linkGrp> <link targets="wordlist.xml#let20-w25-vA file.xml#w1"/> <link targets="wordlist.xml#let20-w32-vC file.xml#w4"/> </linkGrp> </div> ==== And in processing file.xml I want to output something like: ==== <div> <span class="l"> <a id="w1" href="wordlist.html#let20-w25-vA">This</a> <a id="w2" href="wordlist.html#let8-w17-vB">is</a> <a id="w3" href="wordlist.html#let1-w1-vA">a</a> <a id="w4" href="wordlist.html#let20-w32-vc">This</a> </span> </div> ==== Now the reason I'm concerned is that of course linkGrps.xml is quite large. Which was one of the reasons I decided to output these values to a different file, rather than store them in a separate section of wordlist.xml. So I'm wondering what the best/quickest way is to get the wordlist.xml#* token from the correct document('linkGrps.xml')//linkGrp/link. My current solution is iterating over the nodes and matching the one whose tokenized @targets contains the current file.xml id value. But that seems rather brute force and might not be efficiently scalable (I've not tested). I keep thinking I should be using xsl:key but couldn't seem to get it to work with document() properly. Other suggestions? -James -- James Cummings, Cummings dot James at GMail dot com
|
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
|






