私は、変換されたXMLを少し読みやすくする、つまり要素間のcrやタブなどの空白を保存するという新しい要件があります。XSLT:要素間の空白を保持する方法
空白を保存する方法を理解できないようです。
誰かが助けてくれますか?
XMLファイル
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
</Fragment>
</Wix>
XSLファイル:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:m="http://schemas.microsoft.com/wix/2006/wi">
<xsl:preserve-space elements="*" />
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/m:Wix">
<xsl:message>Matched Wix</xsl:message>
<xsl:copy>
<!-- Insert the new include processing instruction -->
<xsl:processing-instruction name="include">
<xsl:text>$(sys.CURRENTDIR)src/includes/globals.wxi </xsl:text>
</xsl:processing-instruction>
<!-- place the existing children into the output -->
<xsl:apply-templates select="@* | *"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
電流出力:
<?xml version="1.0" encoding="UTF-8"?><Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"><?include $(sys.CURRENTDIR)src/includes\globals.wxi ?><Fragment>
</Fragment></Wix>
所望の出力:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?include $(sys.CURRENTDIR)src/includes\globals.wxi ?>
<Fragment>
</Fragment>
</Wix>
"xlst"とは何ですか?良い質問 !!それは私がMacでオートコレクトを再タイピングしようとしていることを意味します。 – garyM