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

Selecting Attribute First Occurrence

Subject: Selecting Attribute First Occurrence
From: siarom egrub <egrubs@xxxxxxxxx>
Date: Tue, 29 Nov 2005 11:54:53 -0800 (PST)
reagentinfo
Hi All!

How can I select the first occurrence of an attribute
in an element with a specific value? I have the
following snippet in an XML document:

<ReagentInfo>
   <table>
      <title>Reagent</title>
        <tgroup cols="2">
           <tbody>
             <row>
               <entry morerows="2"
symbol="ref">88088</entry>	
               <entry symbol="lot">Z501665</entry>	
             </row>
             <row>
               <entry symbol="lot">Z509980</entry>
             </row>
           </tbody>
        </tgroup>
     </table>
</ReagentInfo>

I want to display a symbol [LOT] once and the entry
data (node()) listed next to the symbol.

This is a snippet in the XSL file:

<xsl:for-each select="//ReagentInfo/table">
   <xsl:for-each select="tgroup/tbody/row/entry">
     <fo:block font-size="16pt"  font-weight="bold"
space-before="2.5mm" start-indent="3mm">
      <xsl:if test="@symbol='ref'">
        <fo:external-graphic content-width=".5in"
src="img/ref.svg"/>&#160;
        <xsl:value-of select="node()"/>
        <!--xsl:apply-templates/-->
     </xsl:if><!--Part number [REF]-->
   </fo:block>
   
   <fo:block font-size="16pt" font-weight="bold"
space-before="1.5mm" start-indent="3mm">
     <xsl:choose>
       <xsl:when
test="'(ancestor::*/preceding-sibling::*[@symbol])[last()]/@symbol'">TEST
        <xsl:if test="@symbol='lot'">
          <fo:external-graphic content-width=".5in"
src="img/lot.svg"/>&#160;
          <xsl:value-of select="node()"/>
        </xsl:if>
      </xsl:when>
    </xsl:choose>
  </fo:block>
 </xsl:for-each><!--tgroup/tbody/row/entry-->
</xsl:for-each><!--Reagent/table-->

This is displaying the [LOT] symbol (lot.svg) each
time there is a "lot" value. I want the symbol to
display once.

Thanks in advance for your help!

Regards,
S.E.




	
		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

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.