Advertisement

05.14.2004 at 02:35PM PDT, ID: 20990059
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

XSL issue

Tags: valueliteral, valuelist
I have an XSL file that transforms the same data from one XML format to another. I am having trouble with one aspect of it though... If two of the <Attributes ID=""></Attributes>  nodes have the same ID value then I need to present them as one Node in the new format. Pay particular attential to the nodes where id=14.

The logic is that in the old format, if the <Value> node has an id of -6 then there may be a corresponding <Attributes> node (with the same ID value) that contains a <ValueLiteral>  node with a string that, in the new version needs to be placed in the same <Attributes> node instead of having two <Attributes> nodes with the same ID.

Any help Getting this XSL working properly will be greatly appreciated.

Here is my XSL:

--------------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
<xsl:template match="/">
<Attributes>
<xsl:for-each select="//AttributeSet" >
<AttributeSet>
<xsl:attribute name="id">
<xsl:value-of select="@id" />
</xsl:attribute>
<xsl:for-each select="Attribute" >
<Attribute>
<xsl:attribute name="id">
<xsl:value-of select="@id" />
</xsl:attribute>
<ValueList>
<xsl:for-each select="Value" >
<Value>
<xsl:choose>
<xsl:when test="@id">
<xsl:attribute name="id">
<xsl:value-of select="@id" />
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<ValueLiteral>
<xsl:value-of select="Name" />
</ValueLiteral>
</xsl:otherwise>
</xsl:choose>
</Value>

</xsl:for-each>
</ValueList>
</Attribute>
</xsl:for-each>
</AttributeSet>
</xsl:for-each>
</Attributes>
</xsl:template>
</xsl:stylesheet>



-----------------------------------------------------------------------------------------------------------

Here is my original XML that I need to apply the XSL to:

--------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<SelectedAttributes>
      <AttributeSet id="1951">
            <Attribute id="6">
                  <Value id="31246" />
            </Attribute>
            <Attribute id="31245">
                  <Value id="31253" />
            </Attribute>
            <Attribute id="26446">
                  <Value>
                        <Name>13</Name>
                  </Value>
            </Attribute>
            <Attribute id="14">
                  <Value id="-6" />
            </Attribute>
            <Attribute id="14">
                  <Value>
                        <Name>BRAND NAME</Name>
                  </Value>
            </Attribute>
            <Attribute id="31243">
                  <Value id="31279" />
            </Attribute>
            <Attribute id="10244">
                  <Value id="-10" />
            </Attribute>
      </AttributeSet>
</SelectedAttributes>

---------------------------------------------------------------------------------------------------------------
Here is the output I am currently getting:
---------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<Attributes>
      <AttributeSet id="1951">
            <Attribute id="6">
                  <ValueList>
                        <Value id="31246"/>
                  </ValueList>
            </Attribute>
            <Attribute id="31245">
                  <ValueList>
                        <Value id="31253"/>
                  </ValueList>
            </Attribute>
            <Attribute id="26446">
                  <ValueList>
                        <Value>
                              <ValueLiteral>13</ValueLiteral>
                        </Value>
                  </ValueList>
            </Attribute>
            <Attribute id="14">
                  <ValueList>
                        <Value id="-6"/>
                  </ValueList>
            </Attribute>
            <Attribute id="14">
                  <ValueList>
                        <Value>
                              <ValueLiteral>BRAND NAME</ValueLiteral>
                        </Value>
                  </ValueList>
            </Attribute>
            <Attribute id="31243">
                  <ValueList>
                        <Value id="31279"/>
                  </ValueList>
            </Attribute>
            <Attribute id="10244">
                  <ValueList>
                        <Value id="-10"/>
                  </ValueList>
            </Attribute>
      </AttributeSet>
</Attributes>
---------------------------------------------------------------------------------------------------------------
Here is the output I want:
---------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<Attributes>
      <AttributeSet id="1951" categoryId="50604">
            <Attribute id="31245">
                  <ValueList>
                        <Value id="31253" />
                  </ValueList>
            </Attribute>
            <Attribute id="31243">
                  <ValueList>
                        <Value id="31279" />
                  </ValueList>
              </Attribute>
            <Attribute id="10244">
                  <ValueList>
                        <Value id="-10" />
                  </ValueList>
            </Attribute>
            <Attribute id="6">
                  <ValueList>
                        <Value id="31246" />
                  </ValueList>
            </Attribute>
            <Attribute id="26446">
                  <ValueList>
                        <Value id="-3">
                              <ValueLiteral>13</ValueLiteral>
                        </Value>
                  </ValueList>
            </Attribute>
            <Attribute id="14">
                  <ValueList>
                        <Value id="-6">
                              <ValueLiteral>BRAND NAME</ValueLiteral>
                        </Value>
                  </ValueList>
            </Attribute>
      </AttributeSet>
</Attributes>
Start your free trial to view this solution
Question Stats
Zone: Web Development
Question Asked By: SBennett
Solution Provided By: rdcpro
Participating Experts: 1
Solution Grade: B
Views: 0
Translate:
Loading Advertisement...
05.14.2004 at 11:07PM PDT, ID: 11074151

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.14.2004 at 11:10PM PDT, ID: 11074156

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.14.2004 at 11:20PM PDT, ID: 11074180

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.14.2004 at 11:25PM PDT, ID: 11074193

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.17.2004 at 09:39AM PDT, ID: 11090548

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080236-EE-VQP-29