Vin*_*ent 11 xslt indentation xalan
我正在使用xalan和以下xsl标头:
<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"/>
Run Code Online (Sandbox Code Playgroud)
并且输出没有缩进.
谁有想法?
Jir*_*rka 21
对于缩进,您需要使用不同的命名空间:" 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"/>
Run Code Online (Sandbox Code Playgroud)
tev*_*vch 10
一段时间以来一直在努力,但是只是让它意外地工作:
关键是要添加 <xsl:strip-space elements="*"/>
所以它看起来像这样:
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:java="http://xml.apache.org/xalan/java"
xmlns:xalan="http://xml.apache.org/xslt">
<xsl:output method="xml" encoding="ASCII" indent="yes" xalan:indent-amount="4"/>
<xsl:strip-space elements="*"/>
Run Code Online (Sandbox Code Playgroud)
不知道为什么,但可能删除所有whitespacing有助于xalan找出缩进
Jirka-x1,谢谢你的问题链接.我使用了以下内容(由Ed Knoll 13/Aug/04提出):
<xsl:stylesheet ... xmlns:xslt="http://xml.apache.org/xslt">
<xsl:output ... indent="yes" xslt:indent-amount="4" />
Run Code Online (Sandbox Code Playgroud)
这适用于xalan(java)2.7.1.
归档时间: |
|
查看次数: |
28107 次 |
最近记录: |