RE: [xsl] How to use two xmls for comparing and extracting values

Subject: RE: [xsl] How to use two xmls for comparing and extracting values
From: Jarno.Elovirta@xxxxxxxxx
Date: Thu, 11 Sep 2003 16:54:49 +0300
Hi,

> I am extremely sorry for writing incorrect desired output.
> Actually i would like to have output like
> `val1'val2
> 
> I am having input file having node like this
> <Root att1="val1" and att2="val2".
> 
> I am having the intermediate file which i constructed from 
> input file havin 
> structure.
> 
> <Table Name="Root">
> <Column name="att1"/>
> <Column name="att2"/>
> 
> Now i would like to have output like
> `val1`val2
> 
> <xsl:variable name="Schema" select="document('colHeader.xml')"/>
> 
> In the Schema variable I am having the document root of the 
> intermediate file.
> 
> I am trying to compare name of the attribute of the Root node 
>  against the 
> value of the Column's naame attribute and if they are equal 
> then outputting 
> the value of the attribute of the Root node.

E.g.

  <xsl:variable name="root" select="Root"/>
  <xsl:for-each select="$Schema/Table/Column">
    <xsl:variable name="name" select="@name"/>
    <xsl:if test="$root/@*[name() = $name]">
      <xsl:text>`</xsl:text>
      <xsl:value-of select="$root/@*[name() = $name]"/>
    </xsl:if>
  </xsl:for-each>

but somehow I have this feeling it's not what you're asking for. Anyhow, do you have to have the intermediate document, do you need other than in this later transformation?

Cheers,

Jarno - Assemblage 23: Awake (Imperative Reaction Mix - 138 BPM)

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread