⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tree.xslt

📁 HTC,demo WEB用于。 超大型
💻 XSLT
字号:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
	<xsl:template match="/">
		<xsl:element name="root">
			<xsl:apply-templates select="root"/>
		</xsl:element>
	</xsl:template>
	<xsl:template match="root">
		<xsl:for-each select="*">
			<xsl:call-template name="itemNode"/>
		</xsl:for-each>
	</xsl:template>
	<xsl:template name="itemNode" match="//item">
		<xsl:element name="item">
			<xsl:for-each select="@*">
				<xsl:copy-of select="."/>
			</xsl:for-each>
			<xsl:attribute name="id"><xsl:value-of select="generate-id()"/></xsl:attribute>
			<xsl:attribute name="idx"><xsl:value-of select="ancestor::*[name(parent::node()) = 'root']/@name"/></xsl:attribute>
			<xsl:attribute name="depth"><xsl:value-of select="count(ancestor::*)"/></xsl:attribute>
			<xsl:attribute name="childNumber"><xsl:value-of select="count(child::*)"/></xsl:attribute>
			<xsl:if test="count(following-sibling::*) = 0">
				<xsl:attribute name="isLastNode"><xsl:value-of select="'true'"/></xsl:attribute>
			</xsl:if>
			<xsl:if test="name(parent::node()) = 'root'">
				<xsl:attribute name="firstItem"><xsl:value-of select="'true'"/></xsl:attribute>
			</xsl:if>
			<xsl:for-each select="*">
				<xsl:call-template name="itemNode"/>
			</xsl:for-each>
		</xsl:element>
	</xsl:template>
</xsl:stylesheet>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -