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

Count number of specific child templates

Subject: Count number of specific child templates
From: himanshu padmanabhi <himanshu.padmanabhi@xxxxxxxxx>
Date: Tue, 7 Apr 2009 13:13:41 +0530
 Count number of specific child templates
Case 1

<?xml version='1.0'?>
<?xml-stylesheet href="service1.xsl" type="text/xsl"?>

<parameters>
    <service1>
          <label>first parameter</label>
          <desc>specify machine name</desc>
    </service1>
    <service1>
          <label>second parameter</label>
          <desc>specify machine IP</desc>
    </service1>
    <cmd> -p args1 -t args2 </cmd>
</parameters>

XSL variable should give me value 2 as there are 2 'service1' templates.

Case 2

<?xml version='1.0'?>
<?xml-stylesheet href="service1.xsl" type="text/xsl"?>

<parameters>
    <service2>
          <label>first parameter</label>
          <desc>specify machine name</desc>
    </service2>
    <service2>
          <label>second parameter</label>
          <desc>specify machine IP</desc>
    </service2>
    <service2>
          <label>third parameter</label>
          <desc>specify third param. as Y or N</desc>
    </service2>
    <service2>
          <label>forth parameter</label>
          <desc>specify forth param between 1 to 100</desc>
    </service2>
     <cmd> --name args1 --value args2 --decision args3 --percentage args4</cmd>
</parameters>

XSL variable should give me value 4 as there are 4 'service2' templates.

I am using perl:libxslt processor and using XSL version 1.0.I want xsl
command for giving desired outputs in both cases above,
So,how can I count total number of "service<no.>" templates above
using XSL variable(or any other xsl feature)?
So that I will get total number of arguments for each service.
---------------------------------
Thanks and Regards,
Himanshu Padmanabhi

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-2011 All Rights Reserved.