[oXygen-user] xsl recursive condition

Jarno Elovirta
Fri Jun 26 04:12:05 CDT 2009


Hi,

  <xsl:key name="hand" match="hand" use="@IDM"/>

  <xsl:template match="book">
    <xsl:copy>
      <xsl:apply-templates select="@*"/>
      <xsl:value-of select="key('hand', @ID)/@title"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="node() | @*">
    <xsl:copy>
      <xsl:apply-templates select="node() | @*"/>
    </xsl:copy>
  </xsl:template>

Jarno


On 2009-6-26 12:06, "" <> wrote:

> Hi all,
> I've problem to select a value to one attribute:
> i need to change the content of one element and to select the value by the
> attribute of another element.
> Is it easy? sure, but problem is that i need to select the right element
> within all equal elements. Output is .xml
> It's like this:
> 
> <bookstore>
> <books>
> <book ID=1>History of Italy</book>
> <book ID=2>History of Spain</book>
> <book ID=2/>Tales from China</book>
> </books>
> <other XML section>
> <hand IDM=1 title=Italy/>
> <hand IDM=2 title=Spain/>
> <hand IDM=3 title=China/>
> </other XML section>
> </bookstore>
> 
> it will be like this:
> 
> <bookstore>
> <books>
> <book ID=1>Italy</book>
> <book ID=2>Spain</book>
> <book ID=2/>China</book>
> </books>
> <other XML section>
> <hand IDM=1 title=Italy/>
> <hand IDM=2 title=Spain/>
> <hand IDM=3 title=China/>
> </other XML section>
> </bookstore>
> 
> How can i get it? Thanks everyone for help.
> 
> _______________________________________________
> oXygen-user mailing list
> 
> http://www.oxygenxml.com/mailman/listinfo/oxygen-user




More information about the oXygen-user mailing list