Results 1 to 2 of 2

Thread: The ' ' character, hexadecimal value 0x20, cannot be included in a name

  1. #1
    Join Date
    Apr 2008

    The ' ' character, hexadecimal value 0x20, cannot be included in a name

    I am facing a problem in while compiling XSLT for the Following Input XML

    This is my Input XML..
    <Attribute Name="$State" Value="Available" />
    <Attribute Name="$SubType" Value="MeasurementDevice" />
    <Attribute Name="AbsoluteDeviationNeg" Value="" />
    <Attribute Name="AbsoluteDeviationPos" Value="" />
    <Attribute Name="CheckRange" Value="No" />
    <Attribute Name="ClippingCheckRange" Value="No" />
    <Attribute Name="ClippingIsRangeUsed" Value="False" />
    <Attribute Name="FA[w ]" Value="4535" />
    <Attribute Name="HasAttachment" Value="True" />
    <Attribute Name="IoBus" Value=" " />
    <Attribute Name="IsCalibrated" Value="False" />
    <Attribute Name="IsExternalSensors" Value="False" />

    and my XSLT is

    <xsl:when test="starts-with(@Name,'FA[')">
    <xsl:attribute name="{concat('ATTR',translate(@Name,'&#xA0;&lt;&gt;&quot;,\ǫ梵() ;:`!=_-@+.>$%^?/]~&amp;*$[]#{}|','_'))}">
    <xsl:value-of select="@Value"/>

    When i implement this XSLT i get a crash with a message:

    The ' ' character, hexadecimal value 0x20, cannot be included in a name

    Can any one help me in this regard:

  2. #2
    Join Date
    May 2008
    I just tried it client-side in Firefox 3 (after changing xsl:when to xsl:if because it was a single test) and all was well, except that it came out as attrfaw=4535.

    I think you should be aware of how fn::translate() works. Check out this quote from the W3C XPath documentation on it:
    If there is a character in the second argument string with no character at a corresponding position in the third argument string (because the second argument string is longer than the third argument string), then occurrences of that character in the first argument string are removed. For example, translate("--aaa--","abc-","ABC") returns "AAA".
    In other words, because your replacement is only one character long, the only character that is recognized is &#xA0;. Everything else in the second string is simply removed from @Name. I'm not sure if that is what you wanted, but I figured you might benefit from the information if you didn't know.

    Are you sure there aren't any other errors?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center