帮助XSLT文档 [英] help with XSLT Document
本文介绍了帮助XSLT文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以帮助我逐步理解这个xslt文件,并建议改进它的方法。
< xsl:stylesheet version = 1.0
xmlns:xsl = http://www.w3.org/1999/XSL/Transform >
< xsl:output omit-xml-declaration = 是 < span class =code-attribute> indent = 是 / >
< xsl:strip-space 元素 = * / >
< xsl:variable name = vUpper 选择 =
'ABCDEFGHIJKLMNOPQRSTUVWXYZ' / >
< xsl:variable name = vLower 选择 <跨度类= 代码关键字> =
的跨度> <跨度类= 代码关键字 > 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'跨度> <跨度类= 代码关键字> / >
< xsl:template match = node()| @ * >
< xsl:copy >
< span class =code-keyword>< xsl:apply-templates 选择 = node()| @ * / >
< / xsl:copy >
< / xsl:template >
< xsl:template 匹配 = * [name( )= local-name()] priority = 2 >
< 跨度> xsl:element name = {translate(name(),$ vUpper,$ vLower)}
命名空间 = {namespace-uri()} >
< xsl:apply-templates 选择 = node()| @ * / >
< / xsl:element >
< / xsl:template >
< xsl:template 匹配 = * priority = 1 < span class =code-keyword>>
< xsl:element name =
{substring-before(name(),':')}:{translate(local-name(),$ vUpper,$ vLower)}
命名空间 = {namespace-uri()} >
< xsl:apply-templates 选择 = node()| @ * < span class =code-keyword> / >
< / xsl:element >
< / xsl:template >
< xsl:template 匹配 = @ * [name()= local-name()] < span class =code-attribute> priority = 2 >
< xsl:attribute name = {translate(name(),$ vUpper,$ vLower)}
命名空间 = {namespace-uri()} >
< xsl:value-of 选择 = 。 / >
< / xsl:属性 >
< / xsl:template >
< < span class =code-leadattribute> xsl:template match = @ * 优先级 = 1 >
< xsl:attribute name =
{substring-before(name(),':')}:{translate(local-name(),$ vUpper,$ vLower)}
namespace = {namespace-uri()} >
< ; xsl:value-of selec t = 。 / >
< / xsl :attribute >
< / xsl:template >
< / xsl:stylesheet >
PS:我通过代码项目获得了这个xsl但是现在无法跟踪作者。
提前致谢。
解决方案
vUpper,
vLower)}
namespace = {namespace-uri()} >
< xsl:apply-templates < span class =code-attribute> select = node()| @ * / >
< / xsl:element >
< / xsl:template >
< xsl:template 匹配 = * priority = 1 >
< xsl:element name =
{substring-before(name(),':')}:{translate(local-name(),
VUPPER,
Could any one please help me understand this xslt file step by step and also suggest the ways to improve it.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:variable name="vUpper" select=
"'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:variable name="vLower" select=
"'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[name()=local-name()]" priority="2">
<xsl:element name="{translate(name(), $vUpper, $vLower)}"
namespace="{namespace-uri()}">
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
<xsl:template match="*" priority="1">
<xsl:element name=
"{substring-before(name(), ':')}:{translate(local-name(), $vUpper, $vLower)}"
namespace="{namespace-uri()}">
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
<xsl:template match="@*[name()=local-name()]" priority="2">
<xsl:attribute name="{translate(name(), $vUpper, $vLower)}"
namespace="{namespace-uri()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
<xsl:template match="@*" priority="1">
<xsl:attribute name=
"{substring-before(name(), ':')}:{translate(local-name(), $vUpper, $vLower)}"
namespace="{namespace-uri()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
PS: i got this xsl through code project itself but now am unable to trace the author.
Thanks in advance.
解决方案
vUpper,
vLower)}" namespace="{namespace-uri()}"> <xsl:apply-templates select="node()|@*"/> </xsl:element> </xsl:template> <xsl:template match="*" priority="1"> <xsl:element name= "{substring-before(name(), ':')}:{translate(local-name(),
vUpper,
这篇关于帮助XSLT文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文