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

Novice question: selecting an element based on an attr

Subject: Novice question: selecting an element based on an attribute id
From: ohmson@xxxxxxxxxxxx (ohmson ampere)
Date: Wed, 20 Mar 2002 12:22:34 -0500
 Novice question: selecting an element based on an attr
Dear list,
  I'm an novice user of XSLT but was tasked to transform an incoming XML file into another format. So far so good but I ran into a perplexing problem. Here's the short example of an incoming XML file:

    <object>
        <class  name="TestF">
            <field name="_str1" type="java.lang.String"/>
            <field name="_str3" type="java.lang.String"/>
        </class>
        <String field="_str1" myId="28"><![CDATA[a test of referencing.]]></String>
        <String field="_str3" myIdRef="28"/>
    </object>

  This needs to be transformed simply to

  </object>
        <_str1><![CDATA[a test of string referencing.]]></_str1>
        <_str3><![CDATA[a test of string referencing.]]></_str3>
    </object>

  As you can see, based on "myIdRef", I am supposed to retrieve the original string. In this example, the referent and the reference are close but sometimes in a big document, they could be far apart. I bet I can do this inefficiently by keeping state of all the referents in XSL variables but you folks probably have an better idea on how to do this efficiently.

 (Incidentally, the incoming XML file didn't use the ID and IDREF attributes because I was told that ID and IDREF cannot be a number).

Thanks much, Ohmson
-- 




__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/


 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.