This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Selecting uniquely one 'asset' in XSL
- From: "Craig Aranjo" <aranjo at purplefinder dot com>
- To: <XSL-List at lists dot mulberrytech dot com>
- Date: Thu, 25 Apr 2002 09:40:06 +0100
- Subject: [xsl] Selecting uniquely one 'asset' in XSL
- Reply-to: xsl-list at lists dot mulberrytech dot com
This seems an a trivial problem but I just can't seem to get my head around
it. I want to be able to select one unique 'asset' name from multiple assets
(there are more than 1 asset of the same type) from XML document and display
this in (say) a HTML table. Further entries of the same asset also need to
appear except that the table entry for the asset name will be blank for the
remainder assets.
The XML document looks something like this:
<asset>Oil</asset>
.
<asset>Oil</asset>
.
<asset>Diamonds</asset>
.
<asset>Diamonds</asset>
Here are two attempts of mine when creating the XSL stylesheet:
1:
<xsl:for-each select="parent::asset">
<xsl:if test="position() = 1">
<xsl:apply-templates selectparent::asset"/>
</xsl:if>
</xsl:for-each>
2.
<xsl:variable name="assetname"
select="//asset-name[not(.=preceding::asset-name)]"/>
<xsl:apply-templates select="$assetname"/>
Neither of these achieve the desired result. Could someone please point me
in the right direction.
regards,
Craig
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list