XML til Kommafil eller XSL
HejJeg følgende XML fil som jeg gerne vil have kovateret til en kommafil.
<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<dbo.Article StyleNo="024-10" Season="2003-1" Supplier="EAT TRD" Material="PU" SampleSize="37" LastNo="024" Heel="024" Outsole="Q&Q (PVC)" Origin="Vietnam">
<dbo.ArtCustomer SockMain="PVC" LiningMain="TRICOT" LiningSecond="PVC" Logo="Franco Banetti">
<dbo.ArtSize Size_Interval="36-42">
<dbo.ArtColor Color="Black WL-38927" />
<dbo.ArtColor Color="Lt.Brown WL-38914" />
<dbo.ArtColor Color="Kit WL-38907" />
<dbo.ArtColor Color="White WL-38902" />
</dbo.ArtSize>
</dbo.ArtCustomer>
</dbo.Article>
</ROOT>
Jeg har prøvet at lave en XSL fil, men problemet er jeg ikke kan få de nested <xsl:for-each> til at virke, så alle felter kommer med hvergang, hvis der er flere af samme undertabel.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match = "/">
<HTML>
<HEAD>
<STYLE>
TH
{
background-color: #CCCCCC;
}
</STYLE>
</HEAD>
Comma delimeted file
<BODY>
<xsl:for-each select="/ROOT/dbo.Article">
<p>
"<xsl:value-of select="@StyleNo"/>",
"<xsl:value-of select="@Season"/>",
"<xsl:value-of select="@Supplier"/>",
"<xsl:value-of select="@Material"/>"
"<xsl:value-of select="@SampleSize"/>",
"<xsl:value-of select="@LastNo"/>",
"<xsl:value-of select="@Heel"/>",
"<xsl:value-of select="@Outsole"/>",
"<xsl:value-of select="@Origin"/>",
<xsl:for-each select="/ROOT/dbo.Article/dbo.ArtCustomer">
"<xsl:value-of select="@SockMain"/>",
"<xsl:value-of select="@SockSecond"/>",
"<xsl:value-of select="@LiningMain"/>",
"<xsl:value-of select="@LiningSecond"/>",
"<xsl:value-of select="@Logo"/>",
<xsl:for-each select="/ROOT/dbo.Article/dbo.ArtCustomer/dbo.ArtSize">
"<xsl:value-of select="@Size_Interval"/>",
"<xsl:value-of select="@Logo"/>",
<xsl:for-each
select="/ROOT/dbo.Article/dbo.ArtCustomer/dbo.ArtSize/dbo.ArtColor">
"<xsl:value-of select="@Color"/>",
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</p>
</xsl:for-each>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
Restulatat skulle gerne se således ud:
--------------------------------------
Comma delimeted file
"024-10", "2003-1", "EAT TRD", "PU" "37", "024", "024", "Q&Q (PVC)", "Vietnam", "PVC", "", "TRICOT", "PVC", "Franco Banetti", "36-42", "", "Black WL-38927"
"024-10", "2003-1", "EAT TRD", "PU" "37", "024", "024", "Q&Q (PVC)", "Vietnam", "PVC", "", "TRICOT", "PVC", "Franco Banetti", "36-42", "", "Lt.Brown WL-38914"
"024-10", "2003-1", "EAT TRD", "PU" "37", "024", "024", "Q&Q (PVC)", "Vietnam", "PVC", "", "TRICOT", "PVC", "Franco Banetti", "36-42", "", "Kit WL-38907"
"024-10", "2003-1", "EAT TRD", "PU" "37", "024", "024", "Q&Q (PVC)", "Vietnam", "PVC", "", "TRICOT", "PVC", "Franco Banetti", "36-42", "", "White WL-38902"
Hvis man ikke kan gøre det i XSL, kan nogen så anbefale et program der kan dette. ???