I have control over the format of the XML file and I am writing the XSL file as well.
I also want to process the XML with XSL and send the output from the XSLT processor to a SQL Server table.
-
- Read about how logo jewelry can be used to reward and motivate employees.
-
Recent Posts
- The Methods That The IContact Service Could Help Assist In Website Promotion
- 3D Computer Monitors Rock! – Take Computer Gaming To Another Level
- Using IContact To Optimize The Effectiveness Of Your Email Marketing
- The Reasons Behind Why You Should Use An IContact Coupon Code
- Software Programmers Or Software Developers Are Required To Develop Applications For Various Purposes.
- Several Quick Tricks For Boosting Your Internet Site Web Optimization
- Small businesses now have affordable access to sophisticated online and mobile telephone systems at affordable prices. Check out the big daddy of the Virtual PBX category with this RingCentral Review.
Blogroll
One Comment
Taking the following xml:
<Inventory>
<Line>
<ItemNumber>line</ItemNumber>
<Description>desc</Description>
<Quantity>quan</Quantity>
<Date>date</Date>
</Line>
<Line>
<ItemNumber>1</ItemNumber>
<Description>Oak chairs</Description>
<Quantity>6</Quantity>
<Date>31 Dec 2004</Date>
</Line>
<Line>
<ItemNumber>2</ItemNumber>
<Description>Dining tables</Description>
<Quantity>1</Quantity>
<Date>31 Dec 2004</Date>
</Line>
</Inventory>
A CSV file can be created with the following xsl:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="Inventory">
<xsl:apply-templates select="Line"/>
</xsl:template>
<xsl:template match="Line">
<xsl:for-each select="*">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">
<xsl:value-of select="’,'"/>
</xsl:if>
</xsl:for-each>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
The following CSV output will be given:
line,desc,quan,date
1,Oak chairs,6,31 Dec 2004
2,Dining tables,1,31 Dec 2004
Hope this helps!
Post a Comment