As I understand from docs, XSLT function document() with empty string as parameter should read current XSLT document. But the following code doesn't work:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<state>test2</state>
<xsl:template match="/">
test1
<xsl:value-of select="document('')/*/state"/>
</xsl:template>
</xsl:stylesheet>
When I apply this XSLT to some XML (just for example), I have only "test1" as output. Why line
<xsl:value-of select="document('')/*/state"/>
doesn't print "test2"?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…