Hello,
I just tested the fn:idref function with saxon 7.9 but I got a very
unexpected result:
----------- the xml -------------
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE data [
<!ATTLIST event
id ID #REQUIRED
name CDATA #REQUIRED >
<!ATTLIST participant
name CDATA #REQUIRED
events IDREFS #REQUIRED >
]>
<data>
<events>
<event id="e01" name="Amsterdam"/>
<event id="e02" name="Baltimore"/>
<event id="e03" name="Casablanca"/>
</events>
<participants>
<participant events="e01 e03" name="Alpha"/>
<participant events="e02" name="Bravo"/>
<participant events="e02 e03" name="Charlie"/>
</participants>
</data>
-------- xslt (important part) -------------------
<xsl:template match="participant">
<h3><xsl:value-of select="@name"/></h3>
<xsl:copy-of select="id(@events)" />
<ul>
<xsl:apply-templates select="id(@events)" mode="byparticipant"/>
</ul>
</xsl:template>
<xsl:template match="event" mode="byparticipant">
<li><xsl:value-of select="@name"/></li>
</xsl:template>
<xsl:template match="event">
<h3><xsl:value-of select="@name"/></h3>
<xsl:copy-of select="idref(@id)" />
<ul>
<xsl:apply-templates select="idref(@id)" mode="byevent"/>
</ul>
</xsl:template>
<xsl:template match="participant" mode="byevent">
<li><xsl:value-of select="@name"/></li>
</xsl:template>
---------------- resul by saxon 7.9 -------------
Warning: Cannot write an attribute node when no element start tag is
open
<h3>Alpha</h3>
<event id="e01" name="Amsterdam"></event>
<event id="e03" name="Casablanca"></event>
<ul>
<li>Amsterdam</li>
<li>Casablanca</li>
</ul>
<h3>Bravo</h3>
<event id="e02" name="Baltimore"></event>
<ul>
<li>Baltimore</li>
</ul>
<h3>Charlie</h3>
<event id="e02" name="Baltimore"></event>
<event id="e03" name="Casablanca"></event>
<ul>
<li>Baltimore</li>
<li>Casablanca</li>
</ul>
<h3>Amsterdam</h3>
<ul>e01 e03</ul>
<h3>Baltimore</h3>
<ul>e02e02 e03</ul>
<h3>Casablanca</h3>
<ul>e01 e03e02 e03</ul>
----------------------------------------------------------
Did I misunterstand the meaning of the fn:idref (Finds the elements that
link to the element with a given ID value i.e. This function allows
reverse navigation from IDs to IDREFs.) ?
Regards
Thomas
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list