| Subject: [xsl] Selecting Attribute First Occurrence From: siarom egrub <egrubs@xxxxxxxxx> Date: Tue, 29 Nov 2005 11:54:53 -0800 (PST) | 
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"/> 
        <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"/> 
          <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 | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| Re: [xsl] Problem with obtaining di, David Carlisle | Thread | Re: [xsl] Selecting Attribute First, JBryant | 
| Re: [xsl] Problem with obtaining di, Dimitre Novatchev | Date | RE: [xsl] IDREFS and key(), Dan Vint | 
| Month |