|
Subject: [xsl] Controlling ancestor reference in the result tree From: "Roshan Sharma" <roshansharma@xxxxxxxxxxx> Date: Mon, 12 Mar 2001 07:32:48 |
While traversing thru the locations in xml below, I have 2 questions:
Q 1: How do I get the value of the attr named "name" of the ancestor
Q 2: I recursively call apply-templates for every office locations and
want to print customer node info only once. The attempt to control with var $did_i_print=1 and marking it "0"
failed.I would like to print out the report only if the customer node has child element office as:
<customer name="big_one" revenue="100000000" employees="20000" > <office location="uno" revenue="200000" rent="3000" /> <office location="dos" revenue="300000" rent="2000" /> </customer> <customer name="little_one" revenue="30000" employees="1" />
<xsl:variable name="did_i_print" select="1" />
<xsl:template name="blah" match="office" >
<xsl:if test="contains(name(..),'customer') and ($did_i_print=1)" >
<xsl:value-of select="name[name(..)]" /> <---- Q 1
<---- Q 2
<xsl:variable name="did_i_print" select="0" />desired output:
Customer big_one
Total Rev 1000000000, # of employees 20000
location uno
revenue 20000
rent 3000
location dos
revenue 30000
rent 2000
_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Create an XML output from, FINLEY, Mike | Thread | Re: [xsl] Controlling ancestor refe, Jeni Tennison |
| RE: [xsl] Create an XML output from, FINLEY, Mike | Date | [xsl] Non Existent attribute, and o, Richard Mitchell |
| Month |