Hello.
I am trying to search through XML containing poems. XML for one poem:
------------------------------------------------------------
<gedicht>
<id>gedicht_20071204_fopstronk</id>
<titel>Fopstronk</titel>
<jaar>2007</jaar>
<maand>12</maand>
<dag>04</dag>
<strofen>
<regel>omdat jij niet oplet</regel>
<regel>doe ik het snel</regel>
<regel> </regel>
<regel>want als jij niet</regel>
<regel>dan ik wel</regel>
</strofen>
<plaats></plaats>
<commentaar></commentaar>
</gedicht>
------------------------------------------------------------
. Now, for each occurrence of a search query value within an element <regel>
(line) I want to see the contents of the parent element <titel> (title).
This, I succeed in, using this XSL:
------------------------------------------------------------
<xsl:for-each select="strofen/regel">
<xsl:variable name="line" select="."/>
<xsl:variable name="linelow"
select="translate($line,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
<xsl:if test="contains($linelow,$querylow)">
<xsl:copy-of select="../../titel" />
<br />
</xsl:if>
</xsl:for-each>
------------------------------------------------------------
. However, this returns 1 title for each line containing the query. This
leads to multiple occurrences of the same title, as the query can be present
in multiple lines of 1 poem. As is visible in my output:
http://www.chielie.nl/gedichten/searchtest.xml
. Now. I have read this post:
http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/200501/msg00244.html
which should, I think, solve my problem. But I cannot figure out how to
translate it into something that works in my situation.
I would greatly appreciate any and all help.
I am using XSL version 1 with the XSL1 processor in MSIE7.
Regards,
-----------------------------------------------------------
Kafai Publishing
Michiel F.E. van Reenen
Minckelersweg 8-101
2031 EM Haarlem
t +31 (0) 630646049
f +31 (0) 847439591
info(_at_)kafai(_dot_)nl
http://www.kafai.nl/
KvK Amsterdam 34191142
"Brilliance is built on hard and methodical labour"
-----------------------------------------------------------
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--