Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Grouping/Sorting Problem >Thread Next - Re: Grouping/Sorting Problem Re: Grouping/Sorting ProblemTo: NULL Date: 10/10/2006 1:41:00 PM
Dimitre,
Your transformation results in the following:
<table>
<tr>
<td>Selection 1</td>
</tr>
<tr>
<td>Base Unit Module</td>
</tr>
<tr>
<td>Unit</td>
<td>Elevation</td>
</tr>
<tr>
<td>Unit Roof</td>
<td>Unit Airflow</td>
</tr>
<tr>
<td>Frame</td>
<td>Htg</td>
</tr>
<tr>
<td>Fan Module</td>
</tr>
<tr>
<td>Fan Module</td>
<td>Airflow</td>
</tr>
<tr>
<td>Fan Size</td>
<td>AbsPower</td>
</tr>
</table>
Notice above in the 5th row the first <td> contains 'Frame' and the second
<td> has 'Htg' but it should be the reverse because the displayOrder value
for 'Htg' is 40 and the displayOrder value for 'Frame' is 50.
What it looks like to me is that all the values from
/Products/Begin_Product/Selection/Configuration_Data/Module/Category/@name
are put in the first <td> of each row and all the values from
/Products/Begin_Product/Selection/Performance_Data/Perf_Data/Perf_Module/Perf_Category/@name are put in the second <td> of each row.
But what needs to happen is for each Selection and for each
Configuration_Data/Module=Performance_Data/Perf_Data/Perf_Module, SORT using
@displayOrder and write the @name value left to right in two columns in a
table.
The following gives me the correctly grouped and sorted results but in a
single column. I need help to get it into two columns. I have tried using
POSITION and COUNT functions but can't get it to work.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<html>
<xsl:apply-templates/>
</html>
</xsl:template>
<xsl:template match="/">
<xsl:for-each select="/Products/Begin_Product/Selection">
<xsl:for-each select="Configuration_Data/Module">
<xsl:variable name="vpMod" select
="//Products/Begin_Product/Selection/Performance_Data/Perf_Data/Perf_Module[@nID
= current()/@nID]"/>
<br><b><xsl:value-of select="@name"/></b></br>
<xsl:for-each select="msxsl:node-set(Category|$vpMod//Perf_Category)">
<xsl:sort select="@displayOrder" data-type="number"/>
<br><xsl:value-of select="@name"/> - <xsl:value-of
select="@displayOrder"/></br>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
The xml is below in the event you don't have it from before.
<Products>
<Begin_Product nID="2002421">
<Selection>
<Selection_Number>1</Selection_Number>
<Configuration_Data>
<Module displayOrder="10" nID="4656" name="Base Unit Module">
<Category displayOrder="10" nID="21" name="Unit"/>
<Category displayOrder="50" nID="43" name="Frame"/>
<Category displayOrder="20" nID="67" name="Unit Roof"/>
</Module>
<Module displayOrder="20" nID="4658" name="Fan Module">
<Category displayOrder="10" nID="96" name="Fan Module"/>
<Category displayOrder="20" nID="63" name="Fan Size"/>
</Module>
</Configuration_Data>
<Performance_Data>
<Perf_Data>
<Perf_Module nID="4656" name="Base Unit Module">
<Perf_Category displayOrder="30" nID="10" name="Unit Airflow"/>
<Perf_Category displayOrder="10" nID="91" name="Elevation"/>
<Perf_Category displayOrder="40" nID="13" name="Htg"/>
</Perf_Module>
<Perf_Module nID="4658" name="Fan Module">
<Perf_Category displayOrder="20" nID="23" name="Airflow"/>
<Perf_Category displayOrder="90" nID="30" name="AbsPower"/>
</Perf_Module>
</Perf_Data>
</Performance_Data>
</Selection>
</Begin_Product>
</Products>
I hope I have explained this clearly. Thank you for all your help. Regards,
Sarah
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
