1

In my question here I'm trying to pass in a param to my stylesheet so a user can specify the level of indentation desired. Apparently Xalan cannot read the value of a param into its indent-amount attribute, so I'm trying with this version of Saxon-HE instead.

Saxon has the attribute indent-spaces which I am trying to use as follows:

<xsl:stylesheet
    version="2.0"
    xmlns:saxon="http://saxon.sf.net"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <!-- <xsl:param name="indent-spaces" select="0"/> -->

    <xsl:output indent="yes" method="xml" omit-xml-declaration="yes" saxon:indent-spaces="10"/><!-- Doesn't matter what I make the value of indent-spaces, the output is always indented 3 spaces -->

Why is indent-spaces being ignored?

4

2 回答 2

2

命名空间应该xmlns:saxon="http://saxon.sf.net/"代替xmlns:saxon="http://saxon.sf.net".

于 2013-09-12T17:50:30.600 回答
1

首先,所有 Saxon 扩展都需要 Saxon-PE 或更高版本。

其次,如果您想动态控制序列化参数(例如,从样式表参数中,您可以使用 xsl:result-document:

<xsl:result-document indent="yes" saxon:indent-spaces="{$param}">
  ...
</xsl:result-document>
于 2013-09-15T21:47:19.423 回答