Subject: Re: [xsl] AVT use and doc() function in xslt 2.0? From: Andrew Welch <andrew.j.welch@xxxxxxxxx> Date: Fri, 19 Aug 2011 09:45:05 +0100 |
On 18 August 2011 22:00, <dvint@xxxxxxxxx> wrote: > Interesting idea, but I'm not sure I can appli it in the final case. I > actually have multiple levels I need to match. This is what my code looks > like currently: > > <xsl:variable name="lookup" > select="doc('dmcmapping.xml')/searchReplace/smodelic[@val=current()/modelic]/ ssdc[@val=current()/sdc]/schapnum[@val=current()/chapnum]/ssection[@val=curre nt()/section]/ssubsect[@val=current()/subsect]/ssubject[@val=current()/subjec t]/sdiscode[@val=current()/discode]/sdiscodev[@val=current()/discodev]/sincod e[@val=current()/incode]/sincodev[@val=current()/incodev]/sitemloc[@val=curre nt()/itemloc]/replaceWith"/> > > <xsl:copy-of select="$lookup/modelic"/> > <xsl:copy-of select="$lookup/sdc"/> > <xsl:copy-of select="$lookup/chapnum"/> > <xsl:copy-of select="$lookup/section"/> > <xsl:copy-of select="$lookup/subsect"/> > <xsl:copy-of select="$lookup/subject"/> > <xsl:copy-of select="$lookup/discode"/> > <xsl:copy-of select="$lookup/discodev"/> > <xsl:copy-of select="$lookup/incode"/> > <xsl:copy-of select="$lookup/incodev"/> > <xsl:copy-of select="$lookup/itemloc"/> > > What I have is one really long key stored in multiple elements and > attributes. Now I control the lookup file format, so I might be able to > concatenate all the values into a single key and then change my template > accordingly. You could change the key to be all of the @val attributes joined using a hyphen: match="replaceWith" use="string-join((ancestor::* except searchReplace)/@val, '-')" then you should be able to call using the much shorter: key('blah', string-join((modelic,sdc,chapnum,....), ','), $doc) which if they are in document order anyway then just: key('blah', string-join(*, ','), $doc) > This is for a conversion effort and ultimatley it should be throwaway > code. I just ran the process on 127 documents/files and it ran pretty fast > with the above. Ironically 'throwaway' code often hangs around for long time... -- Andrew Welch http://andrewjwelch.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] AVT use and doc() functio, dvint | Thread | Re: [xsl] AVT use and doc() functio, Wendell Piez |
Re: [xsl] stop the processing of de, David Carlisle | Date | Re: [xsl] redirecting ouput to a di, Andrew Welch |
Month |