正如我之前所说,我已经开始学习XSLT了
当我正在努力时,我得到了错误的XML格式
输入
<?xml version="1.0" encoding="ISO-8859-1"?>
<testingconfig note-ref="no">
<access-panel>113AL</access-panel>
<access-panel>119AL</access-panel>
</testingcongif>
Run Code Online (Sandbox Code Playgroud)
产量
<?xml version="1.0" encoding="ISO-8859-1"?>
<testingconfig>
<panel><panelid>113AL</panelid></panel>
<panel><panelid>119AL</panelid></panel>
</testingconfig>
Run Code Online (Sandbox Code Playgroud)
我的XSL
<?xml version="1.0" encoding="ISO-8859-1"?>
<testingconfig>
<xsl:for-each select="testingconfig">
<panel>
<panelid>
<xsl:value-of select="*"/>
</panelid>
</panel>
</xsl:for-each>
</testingconfig>
Run Code Online (Sandbox Code Playgroud)
出于这个原因
<testingconfig>
<panel>
<panelid>
113AL 119AL
</panelid>
</panel>
</testingconfig>
Run Code Online (Sandbox Code Playgroud)
任何人都可以在这里帮助我,我在做错误,请帮助我在XSLT 2.0中如何做到这一点
请帮助我
谢谢和问候M.
您只需将其分解为一组转换规则.例如:
<xsl:template match="testingfig">
<tscon><xsl:value-of select="."/></tscon>
</xsl:template>
<xsl:template match="config">
<testingvalue>
<testingtype>mar</testingtype>
<testid>mar<xsl:value-of select="."/></testid>
</testingvalue>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
但是,我有点担心,通过给你这些例子,我会把你带到沼泽地,你会很快陷入困境.在你的问题中我觉得你在学习这门语言的开始就是对的,并且在一个论坛上寻求一个简单问题的解决方案并不是最好的学习策略.您无法通过反复试验或通过复制虚拟示例来学习编程语言.你需要离开并阅读一些书籍或教程.