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

Same name Elements in more than one node

Subject: Same name Elements in more than one node
From: Mike Ferrando <mikeferrando@xxxxxxxxx>
Date: Wed, 26 Dec 2001 07:58:40 -0800 (PST)
encodinganalog
Friends,
I am trying to get some simple output from my xml document but I am a
bit puzzled over my results.

Here is my xml:

<C01>

<C02>
  <DID>
    <UNITTITLE>
      <PERSNAME ENCODINGANALOG="100$a">Baylor, Eugene W.</PERSNAME>
      <PERSNAME ENCODINGANALOG="700$a">Baylor, G. W.</PERSNAME>
    </UNITTITLE>
  </DID>
  <C03>
    <DID>
      <CONTAINER TYPE="BOX"></CONTAINER>
      <UNITTITLE ID="PV1624">
        <TITLE>Exquisite waltz</TITLE>
        <GEOGNAME ENCODINGANALOG="260$a">Louisville</GEOGNAME>
        <CORPNAME ENCODINGANALOG="260$b">Peters, Webb &amp;
Co.</CORPNAME>
        <UNITDATE ENCODINGANALOG="260$c">1855</UNITDATE>
      </UNITTITLE>
    </DID>
    <ODD>
      <P>
        <SUBJECT>Piano</SUBJECT>
      </P>
    </ODD>
  </C03>
</C02> 

<C02>
  <DID>
    <UNITTITLE>
      <PERSNAME ENCODINGANALOG="100$a">Abbott, Frank</PERSNAME>
    </UNITTITLE>
  </DID>
  <C03>
    <DID>
      <CONTAINER TYPE="BOX"></CONTAINER>
      <UNITTITLE ID="PV1">
        <TITLE>Cornell grand march</TITLE>
        <GEOGNAME ENCODINGANALOG="260$a">[S.I.]</GEOGNAME>
        <CORPNAME ENCODINGANALOG="260$b">Frank Abbott</CORPNAME>
        <UNITDATE ENCODINGANALOG="260$c">1884</UNITDATE>
       </UNITTITLE>
    </DID>
    <ODD>
      <P>
        <SUBJECT>Piano, organ</SUBJECT>
      </P>
    </ODD>
  </C03>
</C02>

</C01>

Here is my xsl:
   
<TBODY>
<xsl:for-each select="//C02">
  <TR>
    <TD>
      <FONT size="+3">
        <xsl:value-of select=".//PERSNAME[@ENCODINGANALOG='100$a']"/>
      </FONT>
      <xsl:text>&#x20;&#x20;&#x20;&#x20;&#x20;:&#x20;</xsl:text>
        <xsl:value-of select="@ENCODINGANALOG"/>
    </TD>
    <TD>
      <xsl:value-of select=".//PERSNAME[@ENCODINGANALOG='700$a']"/>
        <xsl:text>&#x20;&#x20;&#x20;&#x20;&#x20;:&#x20;</xsl:text>
          <xsl:value-of select="@ENCODINGANALOG"/>
    </TD>
  </TR>
</xsl:for-each>
</TBODY>
</TABLE>

Here is my output:

Baylor, Eugene W. :  Baylor, G. W. :  
Abbott, Frank :   

I am not getting any attributes for these fields.

I want to be sure I am getting the PERSNAME element data in the C02
node only. The attribute ENCODINGANALOG="700$a" is the same for the
element PERSNAME in both the C02 and C03 elements. The C03 elements
have PERSNAME children that have an addition ROLE attribute, but
there is no ROLE attribute for the PERSNAME of the C02 nodes.

I am wondering how I should write the <xsl:for-each> element. Should
I direct it to the UNITTITLE node? I thought that select=//C02 would
be good enough for my style sheet to get the information I wanted.

Mike F.



__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.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.