我正在使用带有以下 xsl header 的 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"/>
并且输出没有缩进。
有人有想法吗?
最佳答案
对于缩进,您需要使用不同的命名空间:http://xml.apache.org/xslt
(见 this issue)
<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"/>
关于xslt - 如何使 xsl 转换缩进输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2402212/