Tinarandel
04-18-2007, 07:32 PM
ok im creating a dummy webservice using c# im familiar with c# and the hard-coding side of this project but xml and xsl come in as a bit of a haze. now i have created an XML file to contain all details needed basically my web service has got to grab the data needed do stuff with it and create a new xml file to be passed around a network. I believe my xml to be correct but i am having trouble even performing simple tasks with xsl. I have followed tutorials as such but cannot get this to work could someone please take a look and tell me if i am doing this correctly.
XML FILE
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="transformBeta.xsl" type="text/xsl"?>
<sale xmlns="http://tempuri.org/Beta.xsd">
<components>
<component id="0">
<company>
Micron
</company>
<product>
RAM(16MB Chip)
</product>
<price>
12
</price>
</component>
<component id="1">
<company>
Samsung
</company>
<product>
RAM(16MB Chip)
</product>
<price>
15
</price>
</component>
<component id="2">
<company>
Samsung
</company>
<product>
Arm9 Processor
</product>
<price>
30
</price>
</component>
<component id="3">
<company>
Marvell
</company>
<product>
Arm9 Processor
</product>
<price>
30
</price>
</component>
<component id="4">
<company>
Marvell
</company>
<product>
Xscale Processor
</product>
<price>
70
</price>
</component>
</components>
<catalogue>
<device devId="0">
<name>
X100
</name>
<part amount="1">
1
</part>
<part amount="1">
2
</part>
<production time="8" />
<setup time="2" />
<price>
56.70
</price>
</device>
<device devId="1">
<name>
X1000
</name>
<part amount="1">
4
</part>
<part amount="4">
0
</part>
<production time="15" />
<setup time="3" />
<price>
188.80
</price>
</device>
<device devId="2">
<name>
Connectors
</name>
<price>
</price>
</device>
</catalogue>
<customers>
<client discount="12">
BDC
</client>
<client discount="15">
Beech
</client>
<client discount="5">
Grimes
</client>
</customers>
<saleRecord>
<cusName>
BDC
</cusName>
<saleDevice id="0" />
<saleDevice id="1" />
</saleRecord>
</sale>
XSL FILE
<?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="customers">
<xsl:for-each select="customer">
<xsl:apply-templates />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
i will probably be flamed for the jargon just posted but i really am quite stuck with this xml malarky...
XML FILE
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="transformBeta.xsl" type="text/xsl"?>
<sale xmlns="http://tempuri.org/Beta.xsd">
<components>
<component id="0">
<company>
Micron
</company>
<product>
RAM(16MB Chip)
</product>
<price>
12
</price>
</component>
<component id="1">
<company>
Samsung
</company>
<product>
RAM(16MB Chip)
</product>
<price>
15
</price>
</component>
<component id="2">
<company>
Samsung
</company>
<product>
Arm9 Processor
</product>
<price>
30
</price>
</component>
<component id="3">
<company>
Marvell
</company>
<product>
Arm9 Processor
</product>
<price>
30
</price>
</component>
<component id="4">
<company>
Marvell
</company>
<product>
Xscale Processor
</product>
<price>
70
</price>
</component>
</components>
<catalogue>
<device devId="0">
<name>
X100
</name>
<part amount="1">
1
</part>
<part amount="1">
2
</part>
<production time="8" />
<setup time="2" />
<price>
56.70
</price>
</device>
<device devId="1">
<name>
X1000
</name>
<part amount="1">
4
</part>
<part amount="4">
0
</part>
<production time="15" />
<setup time="3" />
<price>
188.80
</price>
</device>
<device devId="2">
<name>
Connectors
</name>
<price>
</price>
</device>
</catalogue>
<customers>
<client discount="12">
BDC
</client>
<client discount="15">
Beech
</client>
<client discount="5">
Grimes
</client>
</customers>
<saleRecord>
<cusName>
BDC
</cusName>
<saleDevice id="0" />
<saleDevice id="1" />
</saleRecord>
</sale>
XSL FILE
<?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="customers">
<xsl:for-each select="customer">
<xsl:apply-templates />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
i will probably be flamed for the jargon just posted but i really am quite stuck with this xml malarky...