开发者

Dot '.' in XML-Tags / Transforming w. XSLT

开发者 https://www.devze.com 2022-12-13 02:52 出处:网络
I\'ve got an xml which shoule be transformed using XSLT but there are \".\" in the Tag and in cause of that it doesn\'t work. But the . is allowed in XML-Tags.

I've got an xml which shoule be transformed using XSLT but there are "." in the Tag and in cause of that it doesn't work. But the . is allowed in XML-Tags. Can anybody give me a hint on transforming such a file: XML:

<root.element>
   <test.ele开发者_如何转开发ment>Hello World</test.element>
</root.element>

XSLT:

<xsl:template match="/">
   <test><xsl:value-of select="root.element/test.element"/></test>
</xsl:template> 


xsltproc (libxslt) transforms it properly. But you may try to push it in predicate:

<xsl:value-of select="node()[name()='test.element']"/>


It should work. Tried it with the MS XSLT parser and it works okay.

I did wonder if the problem is in the XPath expression as the dot character has special meaning in XPath, but seems okay.

What is the exact error?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号