Re: [xsl] Multi-part search XPath expressions.

Subject: Re: [xsl] Multi-part search XPath expressions.
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Sat, 11 Sep 2004 10:02:16 -0400
On Sep 11, 2004, at 12:50 AM, David Adams wrote:

I'm still trying to get my head around the language and am now lead
into wondering about subroutines.

Someone else can correct me if I'm off a bit (I'm still learning myself), but you probably need to think about stuff like the following. I'm adding some css-styling-friendly stuff to the code.


<xsl:template match="Australian_Birds">
  <h1>Birds</h1>
  <div id="live">
    <h2>Living Species</h2>
    <xsl:apply-templates select="Species[Extinct='True']"/>
  </div>
  <div id="extinct">
    <h2>Extinct Species</h2>
    <xsl:apply-templates select="Species[Extinct='False']"/>
  </div>
</xsl:template>

<xsl:template match="Species">
<div id="{Species_Name}">
<!-- explicit select statements below are just to reorder the content if needed -->
<xsl:apply-templates select="Species_Name"/>
<xsl:apply-templates select="Family_Name"/>
<xsl:apply-templates select="Genus_Name"/>
</div>
</xsl:template>


<xsl:template match="Species_Name">
  <h3>
      <xsl:value-of select="."/>
  </h3>
</xsl:template>

<xsl:template match="Family_Name">
  <p>Family Name:
    <span class="family_name">
      <xsl:value-of select="."/>
    </span>
  </p>
</xsl:template>

<xsl:template match="Genus_Name">
  <p>Genus Name:
    <span class="genus_name">
      <xsl:value-of select="."/>
    </span>
  </p>
</xsl:template>

Current Thread