Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How to find and display the highest lowest and average prices of a graphics prog

ID: 638667 • Letter: H

Question

How to find and display the highest lowest and average prices of a graphics program for Linux OS?

Here is what I have:

XML

Can someone please show me the xslt. I was told I have to apply another template such as

<xsl:template match="Product_Software/Software/category[@category ='Linux']">
     <xsl:value-of select="format-number(sum(/Product_Software/Software/price)
                  div count(/Product_Software/Software/price[.!=0]),
                  '##0.0')" />

I need to make a template to only select the categories that have Linux and then find the highest lowest and average price and display it.

Product Software> Softwa re xmln s : x sì="http://www.w3.org/2001/XAL Schema-instance" si: noNamespaceSchemaLocation="project. xsd"> Graphic App vendor»Microsoft

Explanation / Answer

I could not understand xactly what you meant(i.e if you wanted only the xslt code or what would happen if the xslt code is put into the xml document), so i will put in a random example. See if this example solves your problem or dilemna..if not do repost again

For Example:

This transformation:

<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="/">
<xsl:for-each select="/*/*/Fare">
<xsl:sort select="sum(Prices/Price/@ticket)" data-type="number"/>

<xsl:if test="position()=1">
<Lowest Total="{sum(Prices/Price/@ticket)}">
<xsl:copy-of select="Prices"/>
</Lowest>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

when applied on the provided XML document:

<Result>
<Fares>
<Fare>
<Prices>
<Price type="adt" ticket="15"/>
<Price type="chd" ticket="10"/>
<Price type="inf" ticket="10"/>
</Prices>
</Fare>
<Fare>
<Prices>
<Price type="adt" ticket="10"/>
<Price type="chd" ticket="10"/>
<Price type="inf" ticket="10"/>
</Prices>
</Fare>
<Fare>
<Prices>
<Price type="adt" ticket="5"/>
<Price type="chd" ticket="5"/>
<Price type="inf" ticket="5"/>
</Prices>
</Fare>
<Fare>
<Prices>
<Price type="adt" ticket="10"/>
<Price type="chd" ticket="5"/>
<Price type="inf" ticket="5"/>
</Prices>
</Fare>
</Fares>
</Result>

Produces the following wanted result:

<Lowest Total="15">
<Prices>
<Price type="adt" ticket="5"/>
<Price type="chd" ticket="5"/>
<Price type="inf" ticket="5"/>
</Prices>
</Lowest>

Thank You
If u find this useful, do rate

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote