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

Matching in IDREFS attributes

Subject: Matching in IDREFS attributes
From: Jean Daniel Fekete 8208 <Jean-Daniel.Fekete@xxxxxx>
Date: Thu, 15 Jul 1999 19:39:18 +0200
idrefs xsl
Hi,

I am new to this list and, although I searched in the archives and
didn't found any similar request, I may have misread or misunderstood
the specs.

I have XML elements with an ANA attribute of type IDREFS.  I want to
iterate over these refs in XSL and create an hypertext link to each
referenced id.  I am using TEILite so I have something like:

<NAME ANA="CRIMINEL MASCULIN" KEY="jb">Jehan Basset</NAME> ...

<INTERP ID="CRIMINEL" VALUE="Le Criminel"/>
<INTERP ID="MASCULIN" VALUE="Sexe masculin"/>

and I want:

Jehan Basset (<A HREF="#CRIMINEL">1</A>, <A HREF="#MASCULIN">2</A>)

I don't care too much about what is inside the <A>..</A> though.

2nd problem, probably harder: I would also like to have a two-way
linking where the <INTERP ...> points back to all its references.

Here is how I did it with IE5 "context()" extension to XSL:

<xsl:template match="INTERP">
 <xsl:if test="ancestor(TEXT)/BODY//*[@ANA=context()/@ID]">
 <DIV><A>
   <xsl:attribute name="NAME"><xsl:value-of select="@ID"/></xsl:attribute>
   <xsl:value-of select="@VALUE"/>:
  </A><SPAN style="color: blue;">
   <xsl:for-each select="ancestor(TEXT)/BODY//*[@ANA=context()/@ID]">
   <A>
    <xsl:attribute name="HREF">#<xsl:value-of select="@ANA"/>-<xsl:eval>ChildNumber(this)</xsl:eval></xsl:attribute>
    <xsl:value-of select="."/>
   </A>
   </xsl:for-each>
  </SPAN>
 </DIV>
 </xsl:if>
</xsl:template>

However, it doesn't work when @ANA is a list since there is no "member 
of" operator as far as I know in XSLT.

Is there any way to do it with XSLT?

  Jean-Daniel Fekete
  Ecole des Mines de Nantes, 4 rue Alfred Kastler, La Chantrerie,
  BP 20722, 44307 Nantes Cedex 03, France
  Voice: +33-2-51-85-82-08  | Fax: +33-2-51-85-82-49
  Jean-Daniel.Fekete@xxxxxx | http://www.emn.fr/fekete/


 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.