[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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"/> then <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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|