14

次のxslヘッダーでxalanを使用しています。

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0"
    xmlns:redirect="http://xml.apache.org/xalan/redirect"
    extension-element-prefixes="redirect"
    xmlns:xalan="http://xml.apache.org/xalan">
<xsl:output method="text" indent="yes" xalan:indent-amount="4"/>

また、出力はインデントされません。

アイデアを持っている人はいますか?

4

5 に答える 5

23

インデントには、別の名前空間を使用する必要があります: http://xml.apache.org/xslt(この問題を参照してください)

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:redirect="http://xml.apache.org/xalan/redirect"
extension-element-prefixes="redirect"
xmlns:xalan="http://xml.apache.org/xslt">
<xsl:output method="xml" indent="yes" xalan:indent-amount="4"/>
于 2011-03-26T16:28:11.360 に答える
5

Jirka-x1 さん、issue-link ありがとうございます。私は以下を使用しました (Ed Knoll 13/Aug/04 によって提案されたとおり):

<xsl:stylesheet ... xmlns:xslt="http://xml.apache.org/xslt">
<xsl:output ... indent="yes" xslt:indent-amount="4" />

これは、xalan (java) 2.7.1 で動作します。

于 2011-05-30T18:15:56.383 に答える
2

methodを に設定する必要があると思いますxml。それでもうまくいかない場合は、次のことを試してください。

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xalan">

<xsl:output method="xml" encoding="UTF-8" indent="yes" xalan:indent-amount="4"/>
于 2010-03-08T15:14:20.777 に答える