[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XSLT 2.0 and implementation of fn:idref in Saxon 7.9

Subject: XSLT 2.0 and implementation of fn:idref in Saxon 7.9
From: "Thomas J. Sebestyen" <a9105535@xxxxxxxxxxxxxxxxx>
Date: Sat, 13 Mar 2004 19:45:07 +0100
xslt fn
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.