给出此xml
<?xml version="1.0" encoding="UTF-8"?>
<h:html xmlns="http://www.w3.org/2002/xforms"
xmlns:h="http://www.w3.org/1999/xhtml"
>
<h:head>
<h:title>h:Title</h:title>
<title>Default Title</title>
</h:head>
</h:html>
如何在XSLT中访问默认标题?我可以轻松得到h:title
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/2002/xforms"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:h="http://www.w3.org/1999/xhtml"
>
<xsl:template match="h:html/h:head">
<xsl:value-of select="h:title"/>
<xsl:value-of select="title"/>
</xsl:template>
</xsl:stylesheet>
答案 0 :(得分:1)
我如何访问默认标题
喜欢吗?
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:h="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="xf h">
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="h:html/h:head">
<root>
<title-h>
<xsl:value-of select="h:title"/>
</title-h>
<title-xf>
<xsl:value-of select="xf:title"/>
</title-xf>
</root>
</xsl:template>
</xsl:stylesheet>
有关说明,请参见:Green Box