XSL 中的命名空间问题到 XML 代
Namespace issues in XSL to XML generation
我正在使用 SAXON 生成 XML,但是名称空间正在附加到 xml 生成的
XSL -->
<?xml version = "1.0" encoding = "UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.xfa.org/schema/xfa-data/1.0/"
xmlns:ext="http://myorg.com">.........
<ELEM>
<xsl:value-of select="$application/ELEM" />
</ELEM>
<LINE_4> ( Using Saxon Extension Function )
xsl:value-of select="ext:FooFunction("someValue")" />
</LINE_4>
生成的输出是
<ELEM xmlns="http://www.xfa.org/schema/xfa-data/1.0/" xmlns:ext="http://myorg.com">NEW JERSEY</ELEM>
<LINE_4
xmlns="http://www.xfa.org/schema/xfa-data/1.0/" xmlns:ext="http://myorg.com">12.99%
</LINE_4>
我不希望命名空间出现在生成的 xml 中。或者它应该属于默认 XML 命名空间,即 http://www.xfa.org/schema/xfa-data/1.0/
我认为您只是想在 xsl:stylesheet
元素上使用 exclude-result-prefixes="ext"
。
我正在使用 SAXON 生成 XML,但是名称空间正在附加到 xml 生成的
XSL -->
<?xml version = "1.0" encoding = "UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.xfa.org/schema/xfa-data/1.0/"
xmlns:ext="http://myorg.com">.........
<ELEM>
<xsl:value-of select="$application/ELEM" />
</ELEM>
<LINE_4> ( Using Saxon Extension Function )
xsl:value-of select="ext:FooFunction("someValue")" />
</LINE_4>
生成的输出是
<ELEM xmlns="http://www.xfa.org/schema/xfa-data/1.0/" xmlns:ext="http://myorg.com">NEW JERSEY</ELEM>
<LINE_4
xmlns="http://www.xfa.org/schema/xfa-data/1.0/" xmlns:ext="http://myorg.com">12.99%
</LINE_4>
我不希望命名空间出现在生成的 xml 中。或者它应该属于默认 XML 命名空间,即 http://www.xfa.org/schema/xfa-data/1.0/
我认为您只是想在 xsl:stylesheet
元素上使用 exclude-result-prefixes="ext"
。