在运行时,我可以有两种格式的XML文件:
<root>
<diagram>
<graph color= "#ff00ff">
<xaxis>1 2 3 12 312 3123 1231 23 </xaxis>
<yaxis>1 2 3 12 312 3123 1231 23 </yaxis>
</graph>
</diagram>
</root>
Run Code Online (Sandbox Code Playgroud)<root>
<diagram>
<graph>
<xaxis>1 2 3 12 312 3123 1231 23 </xaxis>
<yaxis>1 2 3 12 312 3123 1231 23 </yaxis>
</graph>
</diagram>
</root>
Run Code Online (Sandbox Code Playgroud)根据颜色属性的存在,我必须处理xaxis和yaxis的值.
我需要使用XSL来做到这一点.任何人都可以帮我暗示我可以检查这些条件的片段.
我试过用
<xsl: when test="graph[1]/@color">
//some processing here using graph[1]/@color values
</xsl:when>
Run Code Online (Sandbox Code Playgroud)
我收到了一个错误......