| Subject: RE: [xsl] xsl array alternatives (novice) From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 18 Sep 2002 16:12:40 -0400 | 
> Exhibit A. --before > (many other irrelevent records)... > <nodeA att1="True" att2="N" att3="1234"/> > <nodeA att1="True" att2="N" att3="321"/> > <nodeA att1="True" att2="N" att3="456"/> > <nodeA att1="True" att2="Y" att3="9876"/> > <nodeB att1="True" att5="Y" att3="45"/> > <nodeB att1="True" att5="N" att3="65"/> > <nodeC att1="True" att7="Y" att3="784"/> > <nodeC att1="True" att7="Y" att3="412"/> > <nodeC att1="True" att7="N" att3="635"/> > ...(many other irrelevent records) > > I would like to create xml output that looks something like this: > > Exhibit B. --after > (many irrelevent records)... > <nodeA att1="True" att2="N" att3="1234"/> > <nodeA att1="True" att2="N" att3="321"/> > <nodeA att1="True" att2="N" att3="456"/> > <nodeB att1="True" att5="N" att3="65"/> > <nodeC att1="True" att7="N" att3="635"/> > ...(many irrelevent records that may or may not have duplicate attribute > names and values) > <nodeA att1="True" att2="Y" att3="9876"/> > <nodeB att1="True" att5="Y" att3="45"/> > <nodeC att1="True" att7="Y" att3="784"/> > <nodeC att1="True" att7="Y" att3="412"/> > <end of document/>
Why not use a key:
<xsl:key name="getNodes" match="nodeA|nodeB|nodeC" use="@*"/>
Then all you need to do is:
<xsl:copy-of select="key('getNodes','N')"/> <xsl:copy-of select="key('getNodes','Y')"/>
<xsl:template match="parent-of-nodes"> <xsl:copy-of select="*[@* = 'N']"/> <xsl:copy-of select="*[@* = 'Y']"/> </xsl:template>
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx 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 ======================================================================
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| RE: [xsl] xsl array alternatives (n, Stuart Brown | Thread | [xsl] Re: a nicer total sibling cou, Dimitre Novatchev | 
| RE: [xsl] a nicer total sibling cou, Macaulay,Malcolm (US | Date | Re: [xsl] using attribute value as , David Carlisle | 
| Month |