[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

preceding-sibling question

Subject: preceding-sibling question
From: <ming.tan@xxxxxxxxxxx>
Date: Thu, 16 Mar 2006 18:04:46 -0600
xsl template update preceding sibling
Hi, all:

Here's the sample XML that I am working on:

<n-docbody>
  <update.link.block>
   <link.parameter>
    <parameter.name>COUNTY</parameter.name>
    <parameter.value>ABC</parameter.value>
   </link.parameter>
   <link.parameter>
    <parameter.name>CN</parameter.name>
    <parameter.value>123456789</parameter.value>
   </link.parameter>
  </update.link.block>
</n-docbody>

As you can see there are two pairs of parameter.name and parameter.value
elements in my XML, and these are the templates I am using:

  <xsl:template match="/">
         <xsl:element name="listitem">
                            <xsl:apply-templates
select="n-docbody/update.link.block/link.parameter/parameter.value" />
         </xsl:element>
  </xsl:template>

# to generate the county element
 <xsl:template match="parameter.value">
     <xsl:element name="county">
      <xsl:attribute name="linkparam">true</xsl:attribute>
      <xsl:apply-templates/>
     </xsl:element>
  </xsl:template>

The result, I have multiple county elements generated:

<?xml version="1.0" encoding="iso-8859-1"?>
<listitem>
 <casenumber linkparam="true">L00031406</casenumber>
 <casename>BLANCHE LAKS v. STRATHALLAN AT JACKSON LLC</casename>
 <pretty-name>N.J.SUPER.</pretty-name>
 <county linkparam="true">OCN</county>
 <county linkparam="true">L-000314-06</county>
 <filed>01/18/2006</filed>
</listitem>


How do I using preceding-sibling axis to only generate the county
element when and preceding sibling (the parameter.name element) has the
value of "COUNTY"?

Thanks in advance.

Ming Tan

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.