0

I have two different XML files. Each one refers to a CD catalog. What I'm doing is using XSLT for generating a table where each catalog appears in a column. This lets the user compare the catalogs easily.

My idea now is, in the case of some attributes like the price, detect which of the compared CDs has the lowest price and change the background color of the cell to green.

And here is where I don't know how to do it. I can select the minimum price value when all these values are contained in the same XML file, but I can't do it if I work with different XML files.

Here are two example XML files to compare: 1.-

<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog>
<cd>
    <title>Empire Burlesque</title>
    <artist>Bob Dylan</artist>
    <country>USA</country>
    <company>Columbia</company>
    <price>10.90</price>
    <year>1985</year>
</cd>
</catalog>

2.-

<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog>
<cd>
    <title>Hide your heart</title>
    <artist>Bonnie Tyler</artist>
    <country>UK</country>
    <company>CBS Records</company>
    <price>7.30</price>
    <year>1988</year>
</cd>
</catalog>

And here is my XSLT code to generate the comparison table as it is now:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2">
<xsl:template match="/">
 <html>
  <head>
   <link rel="stylesheet" type="text/css" href="..\..\GeossBack\compara.css"/>
  </head>
  <body>
  <h1>Comparison</h1>
   <table border="0" cellspacing="3">
    <tr>
     <td width="250">
      CD Artist
     </td>
     <xsl:for-each select="/csw:GetRecordByIdResponse/catalog">
      <td width="250">
    <xsl:value-of select="cd/artist"/>
      </td>
     </xsl:for-each>
    </tr>
    <tr>
     <td width="250">
    CD Price
         </td>
     <xsl:for-each select="/csw:GetRecordByIdResponse/catalog">
      <td width="250">
    <xsl:value-of select="cd/price"/>
      </td>
     </xsl:for-each>
    </tr>
    <tr>
     <td width="250">
       CD Year              
     </td>
     <xsl:for-each select="/csw:GetRecordByIdResponse/catalog">
      <td width="250">
       <xsl:value-of select="cd/year"/>
      </td>
     </xsl:for-each>
    </tr>
   </table>
  </body>
 </html>
</xsl:template>
</xsl:stylesheet>
mmmmmm
  • 32,227
  • 27
  • 88
  • 117
ogogu
  • 43
  • 1
  • 5
  • Have you searched SO for this problem? It seems [this question](http://stackoverflow.com/questions/102531/xslt-multiple-file-inputs) and the accepted answer could help you out. – Hanno Apr 11 '13 at 12:08
  • I have solved the problem. It works exactly the same way as if you work with just one XML file. So the solution is the same to this qüestion also made by me...[Selecting the lowest value from and xml without sorting](http://stackoverflow.com/questions/15898844/selecting-the-lowest-value-from-and-xml-without-sorting?rq=1) – ogogu Apr 11 '13 at 14:33

0 Answers0