I have this database in stored inside my Visual Studio Express 2013 for web.

How can I use XSLT to turn into:

<?xml version="1.0" encoding="utf-8" ?>

<graph caption='Cashflow' subcaption='(Drag to zoom out)' hovercapbg='FFECAA' hovercapborder='F47E00' formatNumberScale='0'
       decimalPrecision='0' showvalues='0' numdivlines='15' numVdivlines='15'
       yaxisminvalue='1000' yaxismaxvalue='1800' showVLineLabelBorder='1'
       numVisibleLabels='500' legendPosition='RIGHT' SCROLLBAR='Glow' btnSwitchToPinModeTitle='Compare Graphs'>

  <categories>
    <category name='1/1/2014' />
    <category name='1/2/2014' />
    <category name='1/3/2014' />
  </categories>

  <dataset seriesName='Actual Amount'>
    <set value='1800' />
    <set value='1900' />
    <set value='300' />    
  </dataset>

  <dataset seriesName='Threshold'>
    <set value='500' />
    <set value='500' />
    <set value='500' />    
  </dataset>

  <dataset seriesName='Forecast Amount'>
    <set value='2800' />
    <set value='2900' />
    <set value='1300' />    
  </dataset>


</graph>

Please help me as it is very difficult for me >.<

What? sorry I dont understand... I am trying to make an XSLT with the output
of

    <?xml version="1.0" encoding="utf-8" ?>
    <graph caption='Cashflow' subcaption='(Drag to zoom out)' hovercapbg='FFECAA' hovercapborder='F47E00' formatNumberScale='0'
    decimalPrecision='0' showvalues='0' numdivlines='15' numVdivlines='15'
    yaxisminvalue='1000' yaxismaxvalue='1800' showVLineLabelBorder='1'
    numVisibleLabels='500' legendPosition='RIGHT' SCROLLBAR='Glow' btnSwitchToPinModeTitle='Compare Graphs'>
    <categories>
    <category name='1/1/2014' />
    <category name='1/2/2014' />
    <category name='1/3/2014' />
    </categories>
    <dataset seriesName='Actual Amount'>
    <set value='1800' />
    <set value='1900' />
    <set value='300' />
    </dataset>
    <dataset seriesName='Threshold'>
    <set value='500' />
    <set value='500' />
    <set value='500' />
    </dataset>
    <dataset seriesName='Forecast Amount'>
    <set value='2800' />
    <set value='2900' />
    <set value='1300' />
    </dataset>
    </graph>

How do I do it? I do not understand what website you gave me >.<

I have done this:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="/">
    <graph caption='Cashflow' subcaption='(Drag to zoom out)' hovercapbg='FFECAA' hovercapborder='F47E00' formatNumberScale='0'
       decimalPrecision='0' showvalues='0' numdivlines='15' numVdivlines='15'
       yaxisminvalue='1000' yaxismaxvalue='1800' showVLineLabelBorder='1'
       numVisibleLabels='500' legendPosition='RIGHT' SCROLLBAR='Glow' btnSwitchToPinModeTitle='Compare Graphs'>


        <categories>
          <category>
            <xsl:attribute name="name">
              <xsl:value-of select="Rows/row/@Date" />
            </xsl:attribute>
          </category>       
        </categories>


      <dataset>
          <xsl:attribute name="seriesName">
            <xsl:value-of select="Rows/row/@Actual_Amount"/>
          </xsl:attribute>
      </dataset>

      <dataset>
        <xsl:attribute name="seriesName">
          <xsl:value-of select="Rows/row/@Threshold"/>
        </xsl:attribute>
      </dataset>

      <dataset>
        <xsl:attribute name="seriesName">
          <xsl:value-of select="Rows/row/@Forecast_Amount"/>
        </xsl:attribute>
      </dataset>







    </graph>
  </xsl:template>





</xsl:stylesheet>

sadly, i can only get one data...

<graph caption="Cashflow" subcaption="(Drag to zoom out)" hovercapbg="FFECAA" hovercapborder="F47E00" formatNumberScale="0" decimalPrecision="0" showvalues="0" numdivlines="15" numVdivlines="15" yaxisminvalue="1000" yaxismaxvalue="1800" showVLineLabelBorder="1" numVisibleLabels="500" legendPosition="RIGHT" SCROLLBAR="Glow" btnSwitchToPinModeTitle="Compare Graphs">
<categories>
<category name="2014-01-01"/>
</categories>
<dataset seriesName="1800.0000"/>
<dataset seriesName="500.0000"/>
<dataset seriesName="2800.0000"/>
</graph>

Can anyone tell me why is this happening?

show me the qrigmal xml datei

<Rows>
<row Date="2014-01-01" Actual_Amount="1800.0000" Threshold="500.0000" Forecast_Amount="2800.0000"/>
<row Date="2014-01-02" Actual_Amount="1900.0000" Threshold="500.0000" Forecast_Amount="2900.0000"/>
<row Date="2014-01-03" Actual_Amount="300.0000" Threshold="500.0000" Forecast_Amount="1300.0000"/>
<row Date="2014-01-04" Actual_Amount="1200.0000" Threshold="500.0000" Forecast_Amount="2200.0000"/>
<row Date="2014-01-05" Actual_Amount="3000.0000" Threshold="500.0000" Forecast_Amount="4000.0000"/>
<row Date="2014-01-06" Actual_Amount="575.0000" Threshold="500.0000" Forecast_Amount="1575.0000"/>
<row Date="2014-01-07" Actual_Amount="240.1500" Threshold="500.0000" Forecast_Amount="1240.1500"/>
<row Date="2014-01-08" Actual_Amount="8562.0000" Threshold="500.0000" Forecast_Amount="9562.0000"/>
<row Date="2014-01-09" Actual_Amount="4589.0000" Threshold="500.0000" Forecast_Amount="5589.0000"/>
</Rows>

i had for_each

also with foreach

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output method="xml" indent="yes"></xsl:output>
    <xsl:template match="/">
        <graph caption="Cashflow" subcaption="(Drag to zoom out)" hovercapbg="FFECAA" hovercapborder="F47E00" formatNumberScale="0" decimalPrecision="0" showvalues="0" numdivlines="15" numVdivlines="15" yaxisminvalue="1000" yaxismaxvalue="1800"
               showVLineLabelBorder="1" numVisibleLabels="500" legendPosition="RIGHT" SCROLLBAR="Glow" btnSwitchToPinModeTitle="Compare Graphs">
            <xsl:apply-templates select="Rows"></xsl:apply>
        </graph>
    </xsl:template>
    <xsl:template match="Rows">
        <categories>
            <xsl:for-each select="row/@Date">
                <category>
                    <xsl:attribute name="name">
                        <xsl:value-of select="."></xsl:value>
                    </xsl:attribute>
                </category>
            </xsl:for-each>
        </categories>
        <dataset seriesName="Actual Amount">
            <xsl:for-each select="row/@Actual_Amount">
                <set>
                    <xsl:attribute name="seriesName">
                        <xsl:value-of select="."></xsl:value>
                    </xsl:attribute>
                </set>
            </xsl:for-each>
        </dataset>
        <dataset seriesName="Threshold">
            <xsl:for-each select="row/@Threshold">
                <set>
                    <xsl:attribute name="seriesName">
                        <xsl:value-of select="."></xsl:value>
                    </xsl:attribute>
                </set>
            </xsl:for-each>
        </dataset>
        <dataset seriesName="Forecast Amount">
            <xsl:for-each select="row/@Forecast_Amount">
                <set>
                    <xsl:attribute name="seriesName">
                        <xsl:value-of select="."></xsl:value>
                    </xsl:attribute>
                </set>
            </xsl:for-each>
        </dataset>
    </xsl:template>
</xsl:stylesheet>

result

<?xml version='1.0' ?>
<graph numdivlines="15" btnSwitchToPinModeTitle="Compare Graphs" caption="Cashflow" numVdivlines="15" yaxisminvalue="1000" formatNumberScale="0" hovercapbg="FFECAA" decimalPrecision="0" legendPosition="RIGHT" numVisibleLabels="500" showVLineLabelBorder="1" subcaption="(Drag to zoom out)" showvalues="0" yaxismaxvalue="1800" SCROLLBAR="Glow" hovercapborder="F47E00">
  <categories>
    <category name="2014-01-01"></category>
    <category name="2014-01-02"></category>
    <category name="2014-01-03"></category>
    <category name="2014-01-04"></category>
    <category name="2014-01-05"></category>
    <category name="2014-01-06"></category>
    <category name="2014-01-07"></category>
    <category name="2014-01-08"></category>
    <category name="2014-01-09"></category>
  </categories>
  <dataset seriesName="Actual Amount">
    <set seriesName="1800.0000"></set>
    <set seriesName="1900.0000"></set>
    <set seriesName="300.0000"></set>
    <set seriesName="1200.0000"></set>
    <set seriesName="3000.0000"></set>
    <set seriesName="575.0000"></set>
    <set seriesName="240.1500"></set>
    <set seriesName="8562.0000"></set>
    <set seriesName="4589.0000"></set>
  </dataset>
  <dataset seriesName="Threshold">
    <set seriesName="500.0000"></set>
    <set seriesName="500.0000"></set>
    <set seriesName="500.0000"></set>
    <set seriesName="500.0000"></set>
    <set seriesName="500.0000"></set>
    <set seriesName="500.0000"></set>
    <set seriesName="500.0000"></set>
    <set seriesName="500.0000"></set>
    <set seriesName="500.0000"></set>
  </dataset>
  <dataset seriesName="Forecast Amount">
    <set seriesName="2800.0000"></set>
    <set seriesName="2900.0000"></set>
    <set seriesName="1300.0000"></set>
    <set seriesName="2200.0000"></set>
    <set seriesName="4000.0000"></set>
    <set seriesName="1575.0000"></set>
    <set seriesName="1240.1500"></set>
    <set seriesName="9562.0000"></set>
    <set seriesName="5589.0000"></set>
  </dataset>
</graph>

Hello!!
Thank you so much^^

wihtout for_each
as the XML file is run through quickly
time factor 10
since only one loop is run through

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output method="xml" indent="yes"/>
    <xsl:template match="/">
        <graph caption="Cashflow" subcaption="(Drag to zoom out)" hovercapbg="FFECAA" hovercapborder="F47E00" formatNumberScale="0" decimalPrecision="0" showvalues="0" numdivlines="15" numVdivlines="15" yaxisminvalue="1000" yaxismaxvalue="1800"
               showVLineLabelBorder="1" numVisibleLabels="500" legendPosition="RIGHT" SCROLLBAR="Glow" btnSwitchToPinModeTitle="Compare Graphs">
            <xsl:apply-templates select="Rows"/>
        </graph>
    </xsl:template>
    <xsl:template match="Rows">
        <categories>
            <xsl:apply-templates select="row/@Date"/>
        </categories>
        <dataset seriesName="Actual Amount">
            <xsl:apply-templates select="row/@Actual_Amount"/>
        </dataset>
        <dataset seriesName="Threshold">
            <xsl:apply-templates select="row/@Threshold"/>
        </dataset>
        <dataset seriesName="Forecast_Amount">
            <xsl:apply-templates select="row/@Forecast_Amount"/>
        </dataset>
    </xsl:template>
    <xsl:template match="@Date">
        <category>
            <xsl:attribute name="name">
                <xsl:value-of select="."/>
            </xsl:attribute>
        </category>
    </xsl:template>
    <xsl:template match="@Actual_Amount">
        <set>
            <xsl:attribute name="seriesName">
                <xsl:value-of select="."/>
            </xsl:attribute>
        </set>
    </xsl:template>
    <xsl:template match="@Threshold">
        <set>
            <xsl:attribute name="seriesName">
                <xsl:value-of select="."/>
            </xsl:attribute>
        </set>
    </xsl:template>
    <xsl:template match="@Forecast_Amount">
        <set>
            <xsl:attribute name="seriesName">
                <xsl:value-of select="."/>
            </xsl:attribute>
        </set>
    </xsl:template>
</xsl:stylesheet>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.