1つのXSLTスタイルシートで複数のEXSLT拡張を宣言する適切な方法は何ですか?XSLTスタイルシートで複数のEXSLT拡張を宣言する適切な方法
さらに重要なのはxmlns:*="http://exslt.org/*"
の目的は何ですか?
documentationは言う:xmlns:date="http://exslt.org/dates-and-times
は、出力ドキュメントのルートノードに表示されていないためにちょうどように
You can use the extension-element-prefixes attribute to prevent the extension namespaces from being output in the result tree.
がありますか?もしそうなら、それはなぜ重要なのでしょうか?次のスタイルシートで
私はエラーを取得する:
lxml.etree.XMLSyntaxError: Attribute extension-element-prefixes redefined, line 7, column 40
私はlxmlプロセッサとXSLT 1.0を使用しています。
XML入力
<?xml version='1.0'?>
<?xml-stylesheet type="text/xsl" href="stylesheet.xsl" version="1.0"?>
<item>test</item>
XSLT 1.0スタイルシート
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:str="http://exslt.org/strings"
xmlns:date="http://exslt.org/dates-and-times"
extension-element-prefixes="str"
extension-element-prefixes="date">
<xsl:template match="/">
<html>
<body>
<xsl:value-of
select="str:padding(2 - string-length(date:month-in-year()), 0)"/>
<xsl:value-of select="date:month-in-year()"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
HTML出力
<html xmlns:str="http://exslt.org/strings" xmlns:date="http://exslt.org/dates-and-times">
<body>05</body>
</html>