This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Selecting uniquely one 'asset' in XSL



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]