E
eric
Hi,everyone:
I have my xml data defined as
xml data definition I:
<?xml version="1.0"?>
<parents>
<parent>
<id>1000</id>
<name> p1 </name>
<premium> 1000</premium>
<loss> 500 </loss>
<ratio> 50% </ratio>
<child>
<id>1001</id>
<name> c1 </name>
<premium> 2000</premium>
<loss> 500 </loss>
<ratio> 25% </ratio>
</child>
<child>
<id>1002</id>
<name> c2 </name>
<premium> 3000</premium>
<loss> 900 </loss>
<ratio> 30%</ratio>
</child>
</parent>
<parent>
<id>2000</id>
<name> p2 </name>
<premium> 4000</premium>
<loss> 800 </loss>
<ratio> 20%</ratio>
<child>
<id>2001</id>
<name> c3 </name>
<premium> 5000</premium>
<loss> 5000 </loss>
<ratio> 100%</ratio>
</child>
</parent>
<parent>
<id>3000</id>
<name> p3 </name>
<premium> 1000</premium>
<loss> 1500 </loss>
<ratio> 150%</ratio>
</parent>
</parents>
--------------------------------------------------------------------------------
xml definition II:
<?xml version="1.0"?>
<parents>
<parent id=1000>
<child>
<id>1000</id>
<name> p1 </name>
<premium> 1000</premium>
<loss> 500 </loss>
<ratio> 50% </ratio>
</child>
<child>
<id>1001</id>
<name> c1 </name>
<premium> 2000</premium>
<loss> 500 </loss>
<ratio> 25% </ratio>
</child>
<child>
<id>1002</id>
<name> c2 </name>
<premium> 3000</premium>
<loss> 900 </loss>
<ratio> 30% </ratio>
</child>
</parent>
<parent id=2000>
<child>
<id>2000</id>
<name> p2 </name>
<premium> 4000</premium>
<loss> 800 </loss>
<ratio> 20% </ratio>
</child>
<child>
<id>2001</id>
<name> c3 </name>
<premium> 5000</premium>
<loss> 5000 </loss>
<ratio> 100% </ratio>
</child>
</parent>
<parent id=3000>
<child>
<id>3000</id>
<name> p3 </name>
<premium> 1000</premium>
<loss> 1500 </loss>
<ratio> 150% </ratio>
</child>
</parent>
</parents>
------------------------------------------------------------------------------
I would like to get some output(e.g.:html) like following with my xml
data through xsl transformation.
Parent Child Premium Loss Loss ratio
ID ID
1000 1000 1000 500 50%
1001 2000 500 25%
1002 3000 900 30%
subtotal 6000 1900 31.67%
2000 2000 4000 800 50%
2001 5000 5000 100%
subtotal 9000 5800 64.44%
3000 3000 1000 1500 150%
subtotal 1000 1500 150%
total 16000 9200 57.50%
I am wondering which xml definition is easier to write xsl to get this
subtotal and total.
thanks!
Eric
I have my xml data defined as
xml data definition I:
<?xml version="1.0"?>
<parents>
<parent>
<id>1000</id>
<name> p1 </name>
<premium> 1000</premium>
<loss> 500 </loss>
<ratio> 50% </ratio>
<child>
<id>1001</id>
<name> c1 </name>
<premium> 2000</premium>
<loss> 500 </loss>
<ratio> 25% </ratio>
</child>
<child>
<id>1002</id>
<name> c2 </name>
<premium> 3000</premium>
<loss> 900 </loss>
<ratio> 30%</ratio>
</child>
</parent>
<parent>
<id>2000</id>
<name> p2 </name>
<premium> 4000</premium>
<loss> 800 </loss>
<ratio> 20%</ratio>
<child>
<id>2001</id>
<name> c3 </name>
<premium> 5000</premium>
<loss> 5000 </loss>
<ratio> 100%</ratio>
</child>
</parent>
<parent>
<id>3000</id>
<name> p3 </name>
<premium> 1000</premium>
<loss> 1500 </loss>
<ratio> 150%</ratio>
</parent>
</parents>
--------------------------------------------------------------------------------
xml definition II:
<?xml version="1.0"?>
<parents>
<parent id=1000>
<child>
<id>1000</id>
<name> p1 </name>
<premium> 1000</premium>
<loss> 500 </loss>
<ratio> 50% </ratio>
</child>
<child>
<id>1001</id>
<name> c1 </name>
<premium> 2000</premium>
<loss> 500 </loss>
<ratio> 25% </ratio>
</child>
<child>
<id>1002</id>
<name> c2 </name>
<premium> 3000</premium>
<loss> 900 </loss>
<ratio> 30% </ratio>
</child>
</parent>
<parent id=2000>
<child>
<id>2000</id>
<name> p2 </name>
<premium> 4000</premium>
<loss> 800 </loss>
<ratio> 20% </ratio>
</child>
<child>
<id>2001</id>
<name> c3 </name>
<premium> 5000</premium>
<loss> 5000 </loss>
<ratio> 100% </ratio>
</child>
</parent>
<parent id=3000>
<child>
<id>3000</id>
<name> p3 </name>
<premium> 1000</premium>
<loss> 1500 </loss>
<ratio> 150% </ratio>
</child>
</parent>
</parents>
------------------------------------------------------------------------------
I would like to get some output(e.g.:html) like following with my xml
data through xsl transformation.
Parent Child Premium Loss Loss ratio
ID ID
1000 1000 1000 500 50%
1001 2000 500 25%
1002 3000 900 30%
subtotal 6000 1900 31.67%
2000 2000 4000 800 50%
2001 5000 5000 100%
subtotal 9000 5800 64.44%
3000 3000 1000 1500 150%
subtotal 1000 1500 150%
total 16000 9200 57.50%
I am wondering which xml definition is easier to write xsl to get this
subtotal and total.
thanks!
Eric