且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

XML 到制表符分隔的文本

更新时间:2023-10-03 12:48:16

这样的事情应该是一个很好的起点

Something like that should work as a good starting point

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="//Recordset">
<xsl:for-each select="Record">
        <xsl:value-of select="ID"/>
        <!-- tab char -->
        <xsl:text>&#x9;</xsl:text>
        <xsl:value-of select="TIL"/>
        <xsl:text>&#x9;</xsl:text>
        <xsl:value-of select="SET"/>
        <xsl:text>&#x9;</xsl:text>
        <!-- all other fields... -->
        <xsl:value-of select="SystemID"/>
        <!-- line feed char -->
        <xsl:text>&#10;</xsl:text>
        </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>