开发者

is square bracket valid in xsl tag

开发者 https://www.devze.com 2023-01-04 09:06 出处:网络
I want design something like... <DB[0]><xsl:value-of select=\"test\"><DB[0]> which will update th开发者_开发技巧e database table field DB[0] with data test.

I want design something like...

<DB[0]><xsl:value-of select="test"><DB[0]>

which will update th开发者_开发技巧e database table field DB[0] with data test. But it's not working ...as xsl is not allowing [] bracket.


  1. In case you need to create a well-formed XML document, then a string like "<DB[0]>" isn't a legal name.

  2. In case you want to create just text, you can alwyas do so by specifying:

<xsl:output method="text"/>

So, this transformation:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output method="text"/>

 <xsl:template match="/">
   &lt;DB[0]><xsl:value-of select="test"/>&lt;/DB[0]>
 </xsl:template>
</xsl:stylesheet>

when applied on this XML document:

<test>XXX</test>

produces:

<DB[0]>XXX</DB[0]>


XML element Naming Conventions

  • Names can contain any alphanumeric character, but must not start with a number or punctuation character.
  • Names cannot contain spaces.
  • Names must not start with the letters xml, as they could be easily confused with an XML document definition.
  • Do not use ":" characters within element names.

For exact definition, please visit here.

So either '[' or ']' is not allowed.

0

精彩评论

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

关注公众号