Same name sibling elements

Here should go questions about transforming XML with XSLT and FOP.
ameyzzin
Posts: 8
Joined: Tue Feb 15, 2005 12:00 am

Same name sibling elements

Post by ameyzzin »

How can i write a single XSL that will get cpad from under cpadPtAddr and cpad from under cpadPtAddrFlr and output it top a pipe delimited text file.

IO have two xsls that can do this seperately but match template works only for either cpadptAddr or cpadPtAddrFLr

Code: Select all


<?xml version="1.0"?>
<te>
<add>
<alp>45</alp>
<aun>01</aun>
<seq>401C</seq>
<apr/>
<asu/>
<alo>6802</alo>
<ahi>6811</ahi>
<loF>1</loF>
<hiF>15</hiF>
<asn>RUSTICA</asn>
<ri>1</ri>
<con>0</con>
<cn>65</cn>
<city>
<cinm>WESTMINSTER</cinm>
</city>
<zip>
<code>21158</code>
<cmt>2</cmt>
</zip>
<urb>
<unm/>
</urb>
<st>
<stnm>MD</stnm>
</st>
<typ>CIR</typ>
<rla>0</rla>
<cds>0</cds>
<rlex>
<ri>2</ri>
<stnm>6804</stnm>
</rlex>
<cpadPtAddr>
<cpadStrNum>6804</cpadStrNum>
<CPaD>
<cpadMsgID>4</cpadMsgID>
<cpadMsgType>20</cpadMsgType>
<cpadExtMsg>ENTERTHECODE</cpadExtMsg>
<cpadNAP>100</cpadNAP>
<cpadDIADDecides>0</cpadDIADDecides>
<cpadDays>0111111</cpadDays>
<cpadStartDate/>
<cpadEndDate/>
</CPaD>
</cpadPtAddr>
<cpadPtAddrFlr>
<cpadStrNum>6804</cpadStrNum>
<cpadFlr>15</cpadFlr>
<CPaD>
<cpadMsgID>15</cpadMsgID>
<cpadMsgType>20</cpadMsgType>
<cpadExtMsg>BRING BACK</cpadExtMsg>
<cpadNAP>100</cpadNAP>
<cpadDIADDecides>0</cpadDIADDecides>
<cpadDays>0111111</cpadDays>
<cpadStartDate/>
<cpadEndDate/>
</CPaD>
</cpadPtAddrFlr>
</add>
</te>
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi,

It is not clear what output you are expecting nor what is exactly the problem you encountered. You can match on both of cpadPtAddr and cpadPtAddrFlr elements if you use something like match="cpadPtAddr | cpadPtAddrFlr" in an xsl template.
If that does not help please provide more details like current stylesheet, expeced output.

Best Regards,
George
ameyzzin
Posts: 8
Joined: Tue Feb 15, 2005 12:00 am

Post by ameyzzin »

Thanks george ,i need to OR it like you suggested..sorry for not being clear abt my doubts...i got it working
Post Reply