This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: processin each element not on a list
- From: Joerg Heinicke <joerg dot heinicke at gmx dot de>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Sat, 05 Oct 2002 14:37:12 +0200
- Subject: Re: [xsl] processin each element not on a list
- References: <20021005121845.86414.qmail@web80006.mail.yahoo.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hello Dan,
a really efficient solution is the usage of keys:
<xsl:key name="choices" match="choice" use="."/>
<xsl:template match="root">
<xsl:apply-templates select="items"/>
</xsl:template>
<xsl:template match="items">
<xsl:apply-templates select="item[not(key('choices', .))]"/>
</xsl:template>
<xsl:template match="item">
...
</xsl:template>
Regards,
Joerg
Dan Diebolt wrote:
I have xml in substantially the following form:
<root>
<choices>
<choice>A</choice>
<choice>B</choice>
<choice>C</choice>
<choice>D</choice>
</choices>
<items>
<item id="1">A</item>
<item id="2">X</item>
<item id="3">B</item>
<item id="4">C</item>
<item id="5">Y</item>
<item id="6">Z</item>
</item>
</root>
I need to process each item where its content is not one of the
choice values. I need a very efficient solution since I have say
up to 10,000 <items>s and perhaps 100 difference <choice>'s.
Thanks in advance.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list