Subject: Re: [xsl] Combining two node Sets into one From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Thu, 31 Mar 2005 17:38:23 -0500 |
Is there any possible way to combine two node sets into one single node set (assign to variable?) and then add an extra childnode to the set based on which parent node the new node came from.
<xsl:template match="/"> <Trans> <xsl:apply-templates select="//Disbs | //Refunds"> <xsl:sort select="DisbDetail/Ddate | RefDetail/Rdate"/> </xsl:apply-templates> </Trans>
<xsl:template match="Disbs"> <xsl:apply-templates/> <!-- nothing to be done here except select and process our children, which will map --> </xsl:template>
<xsl:template match="DisbDetail"> <!-- maps to TranDetail --> <TranDetail> <!-- but here we need to announce our type: --> <Ttype>dis</Ttype> <xsl:apply-templates/> <!-- descends another level --> </TranDetail> </xsl:template>
<xsl:template match="Damount"> <Tamount> <xsl:apply-templates/> </Tamount> </xsl:template>
<xsl:template match="RefDetail"> <!-- maps to TranDetail, and descends another level --> <TranDetail> <!-- but here we need to announce our type: --> <Ttype>refund</Ttype> <xsl:apply-templates/> </TranDetail> </xsl:template>
<xsl:template match="DisbDetail | RefDetail"> <!-- maps to TranDetail, and descends another level --> <TranDetail> <!-- but here we need to announce our type: --> <Ttype> <xsl:choose> <xsl:when test="self::DisbDetail">dis</xsl:when> <xsl:otherwise>refund</xsl:otherwise> </xsl:choose> </Ttype> <xsl:apply-templates/> </TranDetail> </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 -> |
---|---|---|
[xsl] Combining two node Sets into , Williamson, Chris | Thread | [xsl] xsl list item writes over th, josh higgins |
Re: [xsl] xsl list item writes ove, Eliot Kimber | Date | Re: [xsl] xsl list item writes ove, Wendell Piez |
Month |