xsl-list
[Top] [All Lists]

Re: [xsl] Writing array elements based on a an evaluation of one of the child elements

2006-05-24 10:23:04
<xsl:template match="ACCOUNT-LIST">
  <xsl:copy-of select="self::*[normalize-space(ACCOUNT-NO)]"/>
</xsl:template>

Cheers,
Wendell

At 09:00 AM 5/24/2006, you wrote:
There are several occurences of ACCOUNT-LIST each with the same 3 child elements.
The first child element in any occurence of ACCOUNT-LIST is ACCOUNT-NO
Should this ACCOUNT-NO element have no value (which I am trying to determine by assesing the string-length of ACCOUNT-NO/text()) then I do not want to write the entire ACCOUNT-LIST element for the specific occurence.

therefore looking at the example below, I want to only have the first 2 occurences of the ACCOUNT-LIST appear in my result

XML I Get ...

<?xml version="1.0" encoding="UTF-8"?>
<Get_AccountNumber_List>
   <CLIENT_CODE6>BABICK 001</CLIENT_CODE6>
<ACCOUNT-LIST>
  <ACCOUNT-NO>0000000054840004</ACCOUNT-NO>
  <SBU-CODE>2</SBU-CODE>
  <RISK_TYPE>CUR</RISK_TYPE>
</ACCOUNT-LIST>
<ACCOUNT-LIST>
  <ACCOUNT-NO>0000000710207909</ACCOUNT-NO>
  <SBU-CODE>2</SBU-CODE>
  <RISK_TYPE>CMS</RISK_TYPE>
</ACCOUNT-LIST>
<ACCOUNT-LIST>
   <ACCOUNT-NO></ACCOUNT-NO>
   <SBU-CODE></SBU-CODE>
   <RISK_TYPE></RISK_TYPE>
</ACCOUNT-LIST>
</Get_AccountNumber_List>

XML I WANT...

<?xml version="1.0" encoding="UTF-8"?>
<Get_AccountNumber_List>
   <CLIENT_CODE6>BABICK 001</CLIENT_CODE6>
<ACCOUNT-LIST>
  <ACCOUNT-NO>0000000054840004</ACCOUNT-NO>
  <SBU-CODE>2</SBU-CODE>
  <RISK_TYPE>CUR</RISK_TYPE>
</ACCOUNT-LIST>
<ACCOUNT-LIST>
  <ACCOUNT-NO>0000000710207909</ACCOUNT-NO>
  <SBU-CODE>2</SBU-CODE>
  <RISK_TYPE>CMS</RISK_TYPE>
</ACCOUNT-LIST>
</Get_AccountNumber_List>


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--