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

RE: Numbered Elements

Subject: RE: Numbered Elements
From: "Jack Cane" <jwcane@xxxxxxxxxxx>
Date: Sat, 3 May 2003 13:27:20 -0400
RE:  Numbered Elements

So, the key runs independent of the number element, and just picks up all
occurrences of  "Equation", in order, and returns the key value for the
matched IdRef value?

I added items shown below. The result is a blank.

<xsl:key name="kEqn" match="Equation" use="Target" />

<xsl:template match="etd:xRef">
	<xsl:apply-templates select="key('kEqn', etd:RefElemID)"/>

Equation and Target are both elements declared within the etd namespace. I
tried the template with and without etd: prefixes.



-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Michael Kay
Sent: Saturday, May 03, 2003 11:02 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Numbered Elements

> Still new to XML/XSLT, I am trying to get my arms around the
> numbering methods in XML. Believe I have succeeded in
> auto-numbering figures, equations, tables, etc. Now I need to
> refer to an element by number. From textbooks and online
> reading I have the following:
> An element Equation of type EquationType:
>    <xs:complexType name="EquationType">
>       <xs:element name="Expression" type="xs:string"/>
>       <xs:element name="Target" type="xs:ID" use="required" />
>    </xs:complexType>
> An element xRef of type xRefType:
>    <xs:complexType name="xRefType">
>       <xs:sequence>
>          <xs:element name="RefElemType" type="xs:string"/>
>          <xs:element name="RefElemID" type="xs:IDREF"/>
>       </xs:sequence>
>    </xs:complexType>
> The Transform template of xRef is
>    <xsl:template match="etd:xRef">
>       <xsl:apply-templates select="number[@Target='etd:RefElemID']" />
>    </xsl:template>
> Instead of the number of the equation having the indicated
> target value, the result is a blank. There are no error messages.
You have tried to select a child element called "number" and there isn't
one. If there were one, you would be selecting it only if its @Target
attribute were equal to the string "etd:RefElemId". But Target is not an
attribute, it is an element, and the string is not a string, it is an
element name - so you seem pretty confused.

I think you want

<xsl:key name="k" match="Equation" use="Target"/>


<xsl:apply-template select="key('k', etd:RefElemId)"/>

though I'm guessing wildly about the namespace.

Michael Kay

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread
  • Numbered Elements
    • Jack Cane - Fri, 2 May 2003 21:52:16 -0400 (EDT)
      • Michael Kay - Sat, 3 May 2003 11:01:56 -0400 (EDT)
        • Jack Cane - Sat, 3 May 2003 13:26:53 -0400 (EDT) <=
      • <Possible follow-ups>
      • cknell - Sat, 3 May 2003 09:43:19 -0400 (EDT)
        • Jack Cane - Sat, 3 May 2003 12:01:04 -0400 (EDT)
      • cknell - Sat, 3 May 2003 20:12:58 -0400 (EDT)
        • Jack Cane - Sat, 3 May 2003 21:22:00 -0400 (EDT)


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.
First Name
Last Name
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.