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

XML/XSLT Problem

Subject: XML/XSLT Problem
From: "Alex Genis" <agenis@xxxxxxxx>
Date: Mon, 29 Jul 2002 15:30:48 -0400
alex genis
Hi everybody.
I have input XML Document like this:

   <ABC>
  <efg>fgh</efg>
  <hij>sdf</hij>
  <abc>
    <PP id="111" id-1="222" >
      <IPI id="333" id-2="444" >
       <p1>p1p1p1</p1>
      </IPI>
      <IPI id="sss" id-2="666" >
       <p1>p2p2p2</p1>
      </IPI>
    </PP>
    <PP id="777" id-1="888" >
      <IPI id="123" id-2="234" >
       <p1>p3p3p3</p1>
      </IPI>
      <IPI id="456" id-2="567" >
       <p1>p4p4p4</p1>
      </IPI>
    </PP>
    <IP id="rrr" id-1="aaa">
      <i1>i1i1i1</i1>
    </IP>
    <IP id="sss" id-1="bbb">
      <i1>i2i2i2</i1>
    </IP>
    <IP id="ttt" id-1="ccc">
      <i1>i3i3i3</i1>
    </IP>
    <IP id="uuu" id-1="ddd">
      <i1>i4i4i4</i1>
    </IP>
    <PR id="xxx">
      <r1>r1r1r1</r1>
    </PR>
    <PR id="bbb">
      <r1>r2r2r2</r1>
    </PR>
    <PR id="zzz">
      <r1>r3r3r3</r1>
    </PR>
  </abc>
</ABC>

I need to create XSLT Stylesheet which retrieves from this XML only those
elements "PP", "IP" and "PR" where:
(PP/IPI/@id = IP/@id) and (IP/@id-1 = PR/@id).

Other words I should have result containing:

<abc>
    <PP id="111" id-1="222" >
      <IPI id="333" id-2="444" >
       <p1>p1p1p1</p1>
      </IPI>
      <IPI id="sss" id-2="666" >
       <p1>p2p2p2</p1>
      </IPI>
    </PP>
    <IP id="sss" id-1="bbb">
      <i1>i2i2i2</i1>
    </IP>
    <PR id="bbb">
      <r1>r2r2r2</r1>
    </PR>
</abc>

If beeing already within <xsl:template match="abc">
I use <xsl:apply-templates select="PP|IP|PR"> - I can not refer to the
attributes of this elements ("id" and "id-1") because this attribute names
are not unique.
(the same problem if I use <xsl:for-each...>)

Can somebody give me a hint  how can I solve this problem?
Your help will be deeply appreciated. Thanks.




 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.