|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Selecting Attribute First Occurrence
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








