xsl-list
[Top] [All Lists]

RE: [xsl] Searching in Sub-children from an Array

2006-12-12 08:33:33
David,

Sorry for late feedback. I was dragged from one meeting into other
(short before release).  I tried it out and extended the XSLT according
to your example and it works wonderful! Thumbs up!


Thanks
Houman

-----Original Message-----
From: David Carlisle [mailto:davidc(_at_)nag(_dot_)co(_dot_)uk] 
Sent: 07 December 2006 12:31
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Searching in Sub-children from an Array



<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  
  <xsl:key name="step" match="fruit_adjustment/color" use="../Steps"/>

  <xsl:template match="*">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>
  
  <xsl:template match="fruit_adjustment"/>
  
  <xsl:template match="color">
    <xsl:copy-of
select="(key('step',string-join(ancestor-or-self::*[(_at_)ID]/@ID,',')),.)[1]
"/>
  </xsl:template>

</xsl:stylesheet>




David



$ saxon8 fruit.xml fruit.xsl 
<?xml version="1.0" encoding="UTF-8"?><tree>
        <fruit ID="111">
                <mango ID="333">
                        <color>green</color>
                </mango>
                <orange ID="222">
                        <color>orange</color>
                </orange>
        </fruit>

</tree>

--~------------------------------------------------------------------
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>
--~--


--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>