[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Problem generating default attribute values.


Subject: [xsl] Problem generating default attribute values.
From: "Jonathan Jenkins" <jon.jenkins@xxxxxxxxxxxxxxxxx>
Date: Fri, 15 Nov 2002 11:33:21 -0000

I couldn't find anything specific to my problem in the FAQ - although 
it is related to flattening..

I have the following XML input.

<transaction-list>
	<transaction total="T1" >
	   <breakdown account="B" amount="Y" />
	   <breakdown account="D" amount="Z" />
	   <breakdown account="A" amount="X" />
         <!-- no two breakdown children have -->
         <!-- the same account attribute value --> 
	</transaction>
	
	<transaction total="T2" >
	   <breakdown account="B" amount="P" />
	   <breakdown account="A" amount="R" />
	   <breakdown account="C" amount="Q" />
         <!-- no two breakdown children have -->
         <!-- the same account attribute value --> 
	</transaction>
</transaction-list>

I would like to generate this.

<dest-transaction-list total="total" A="A" B="B" C="C" D="D">
	<dest-transaction   total="T1" A="X" B="Y" C="0" D="Z"/>
	<dest-transaction   total="T2" A="R" B="P" C="Q" D="0"/>
</dest-transaction-list>

Each transaction should map to a dest-transaction element, which
is a straightforward transformation, apart from one thing.

Each dest-transaction needs to have an attribute value for every account
attribute value. If the particular account attribute value does
not exist as a child of the corresponding transaction/breakdown 
element, then it should output a zero '0'.

I hope the XML is clearer than my explanation or the subject title..

-Jon


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords
xml