0

11 MB の xml ファイルに対して次のアイデンティティ変換を実行すると、5.5 MB のファイルになります。Saxon 9.4.0.6 を使用しています。出力要素にエンコーディング属性を追加すると、結果ファイルのサイズは 11 MB のままです。

エンコーディングあり:

<xsl:output method="xml" cdata-section-elements="Value" indent="no" encoding="utf-16"/>

エンコードなし:

<xsl:output method="xml" cdata-section-elements="Value" indent="no"/>

大きな違いはどこから来るのですか?ありがとうございました

XSLT:

<?xml version="1.0" encoding="utf-16"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" cdata-section-elements="Value" indent="no"/>
<xsl:strip-space elements="*"/>

<xsl:template match="/">
    <xsl:apply-templates select="*"/>
</xsl:template>

<xsl:template match="node()|@*">
    <xsl:copy>
        <xsl:apply-templates select="node()|@*" mode="#current"/>
    </xsl:copy>
</xsl:template>

4

1 に答える 1

0

違いは、ASCII 文字が UTF-8 では 1 バイト、UTF-16 では 2 バイトであるという事実によるものです。

于 2012-11-28T16:45:08.503 に答える