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]

RE: Searching for a particular node


Hi,

> Is it possible using XSL to select a node based on a 
> particular value ...
> for example in the following xml, I want to select the 
> <entity> node with an
> id of 'e14'. My question is, how do I accomplish this with 
> XSL using @id?

<xsl:template match="tree">
  <xsl:apply-templates select="entity[@id = 'e14']" />
<xsl:template match="entity">

or if the id attribute is declared ID in the DTD

<xsl:template match="tree">
  <xsl:apply-templates select="id('e14')" />
<xsl:template match="entity">

or if you have a zillioin entity elements, declare a key

<xsl:key name="entities" match="entity" use="@id" />

<xsl:template match="tree">
  <xsl:apply-templates select="key('entities', 'e14')" />
<xsl:template match="entity">

Santtu

 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]