Advertisement
cd62131

XML Attribute Node to CSV

Dec 18th, 2018
712
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 0.73 KB | None | 0 0
  1. <xsl:stylesheet
  2.  version="1.0"
  3.  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  4.   <xsl:output method="text"/>
  5.   <xsl:strip-space elements="*"/>
  6.   <xsl:template match="/">
  7.     <xsl:text>"Id","Count","ExcerptPostId","WikiPostId"</xsl:text>
  8.     <xsl:text>&#xa;</xsl:text>
  9.     <xsl:apply-templates select="//row"/>
  10.   </xsl:template>
  11.   <xsl:template match="row">
  12.     <xsl:value-of select="@Id"/><xsl:text>,</xsl:text>
  13.     <xsl:text>"</xsl:text><xsl:value-of select="@TagName"/><xsl:text>",</xsl:text>
  14.     <xsl:value-of select="@Count"/><xsl:text>,</xsl:text>
  15.     <xsl:value-of select="@ExcerptPostId"/><xsl:text>,</xsl:text>
  16.     <xsl:value-of select="@WikiPostId"/><xsl:text>&#xa;</xsl:text>
  17.   </xsl:template>
  18. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement