Subject: Re: [xsl] Finding Non-Matching Text From: Abel Braaksma <abel.online@xxxxxxxxx> Date: Wed, 18 Apr 2007 16:09:26 +0200 |
Hi,
I have a reference file like this:
<root> <entry>text 1</entry> <entry>text 2</entry> </root>
the entry elements may reach up to more than a thousand. I need to generate a list of entry elements that does not have a match in my source xml.
my source xml looks like:
<source> <head>some text 1 some text some text some text</head> </source>
what i do in my xslt is to iterate each of the entry elements and try to look for a match if there is none then i report it.
<xsl:template match="/">
<xsl:for-each select="$refence.file/entry">
<xsl:if test="not(exists(//text()[ancestor::head][matches(., concat('(^|\W)(',current(),')($|\W)'))]))">
<xsl:message>
<xsl:value-of select="."/>
</xsl:message>
</xsl:if>
</xsl:for-each>
</xsl:template>
but this method tends to be rather slow when i have a reference file that has many entries. Is there another way to go around this, by keys maybe?
Thanks,
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Finding Non-Matching Text, Jeff Sese | Thread | [xsl] XSLT recursive template to ch, Tech Guru |
Re: [xsl] Finding distinct nodes us, Dimitre Novatchev | Date | [xsl] XSLT recursive template to ch, Tech Guru |
Month |