Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Grouping/Sorting Problem

From: "Dimitre Novatchev" <dimitren@---.---.-->
To: NULL
Date: 10/9/2006 8:44:00 PM

Dear Sarah,

I have checked and re-checked that the transformation provided in my last 
message, when applied on the exact source xml document in your original 
message produces the exact wanted results as specified in your original 
message.

It seems that now you have other, yet not described problems -- please, 
describe them in detail that will allow them to be understood -- preferrably 
in a separate message.

Do understand that the ability of anybody to solve a problem directly 
depends on how well (clearly, compactly, unambiguously, etc. ...) this 
problem is presented.


Cheers,
Dimitre Novatchev

"Sarah_Lund" <SarahLund@d...> wrote in message 
news:AB8EC82E-27F9-4A2E-8417-890ECB7A7E0C@m......
> Thank you, that gets me partially there but the way you suggest doesn't 
> put
> the results in the 2 columns in order. Do you see how I could modify the
> following to get the data in two columns?
> <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>
>
>
> "Dimitre Novatchev" wrote:
>
>> The following transformation produces the desired result -- without any
>> intermediate RTFs and the need to convert them to regular trees:
>>
>> <xsl:stylesheet version="1.0"
>>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>>  <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="Selection_Number">
>>    <table>
>>    <tr><td>Selection <xsl:value-of select="."/></td></tr>
>>      <xsl:for-each select="../Configuration_Data/Module">
>>        <xsl:sort select="@displayOrder" data-type="number"/>
>>        <xsl:variable name="vpMod" select=
>>        "../../Performance_Data/Perf_Data/Perf_Module
>>           [@nID = current()/@nID]
>>        "/>
>>        <tr>
>>          <td><xsl:value-of select="@name"/></td>
>>        </tr>
>>            <xsl:for-each select="Category">
>>              <xsl:sort select="@displayOrder" data-type="number"/>
>>              <xsl:variable name="vPos" select="position()"/>
>>            <tr>
>>              <td>
>>                <xsl:value-of select="@name"/>
>>              </td>
>>              <td>
>>                <xsl:for-each select="$vpMod/Perf_Category">
>>                  <xsl:sort select="@displayOrder" data-type="number"/>
>>                  <xsl:if test="position() = $vPos">
>>                    <xsl:value-of select="@name"/>
>>                  </xsl:if>
>>                </xsl:for-each>
>>              </td>
>>            </tr>
>>
>>            </xsl:for-each>
>>      </xsl:for-each>
>>    </table>
>>  </xsl:template>
>> </xsl:stylesheet>
>>
>>
>>
>> Cheers,
>> Dimitre Novatchev
>>
>> "Sarah_Lund" <SarahLund@d...> wrote in message
>> news:570EFAE9-042E-44D0-8C14-4E63A662D991@m......
>> > First I need to create a table for each Selection
>> > Then within each table I need to group by each
>> > Configuration_Data/Module/@nID =
>> > Performance_Data/Perf_Data/Perf_Module/@nID
>> > Then for each Configuration_Data/Module/@nID =
>> > Performance_Data/Perf_Data/Perf_Module/@nID I need to display
>> > Category/@name
>> > and Perf_Category/@name but these must be sorted according to
>> > Category/@displayOrder and Perf_Module/Perf_Category/@displayOrder
>> >
>> > So for each Configuration_Data/Module/@nID =
>> > Performance_Data/Perf_Data/Perf_Module/@nID I need to dump all Category
>> > and
>> > all Perf_Module/Perf_Category into a set and then sort them all by 
>> > their
>> > @displayOrder.
>> >
>> > And then display them left to right in two columns in the table. The
>> > results
>> > would like like 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>Htg</td><td>Frame</td></tr>
>> > <tr><td>Fan Module</td></tr>
>> > ...
>> > </table>
>> >
>> > I had gotten help to get something like this working in the past but
>> > having
>> > trouble applying to this case. Any help is appreciated!
>> > An excerpt from the xml file is below:
>> > <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>
>>
>>
>> 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent