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

Matching elements with a name specified by an attribute valu

Subject: Matching elements with a name specified by an attribute value
From: "SCOTT, Darren, FM" <Darren.Scott@xxxxxxxx>
Date: Fri, 20 Oct 2000 13:58:21 +0100
darren scott
Is it possible to match on elements where the names of the elements to look
for are specified as the attribute values of other elements ie. the element
name to match is specified at processing time?

Consider the example source XML...

<layout>
  <layout_item data_element="item1"/>
  <layout_item data_element="item2"/>
  <layout_item data_element="item3"/>
</layout>

<item1>I am item 1</item1>
<item2>I am item 2</item2>
<item3>I am item 3</item3>

In this example, I am intending that the <layout> element and it's child
<layout_item> elements specify the order and placement of items, and the
data for these items is specified in the elements referenced by the
"data_element" attributes.

So when the XSLT processes the first <layout_item> element it would need to
fetch the data value from the element specified in its "data_element"
attribute, namely <item1>. This is repeated until all <layout_item>s have
been processed.

I can get this method to work when matching on attribute values instead of
element names ie. each <item1>, <item2> etc element has another attribute
(say "data_ref") which specifies the value that the "data_element"
references. In this case a simple XPath predicate such as
[@data_element=@data_ref] does the job.

Can anyone suggest a way of achieving this, if it is at all possible?


********************************************************************
This e-mail is intended only for the addressee named above.
As this e-mail may contain confidential or privileged information,
if you are not the named addressee, you are not authorised to
retain, read, copy or disseminate this message or any part of it.
********************************************************************


 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.