gladys0313
gladys0313

Reputation: 2679

xsl: Is "$" a special character in xsl and what does this line mean

I am learning a large set of codes, in which scripts are written in C++, xml, xsl, python..etc and some interfaces are established.

In this set of codes I have some .efa scripts (simkin scripts written in xml format), most of them have identifiers like this:

 CONST_ACTIVATION_STATE$ON

Then I find a C++ code which reads these .efa files and parses this identifier according to the format. I am confused why such kind of identifiers are defined, but later on I find this in a xsl script

Example usage for efa's:
  <xsl:choose><xsl:when test="starts-with(string(../@name),'global:')">
     CONST_GLOB_DEF_<xsl:value-of select="script:toConstant(string(substring-after(../@name, ':')))"/>$<xsl:value-of select="script:toConstant(string(param/@name))"/>
     </xsl:when>
     <xsl:otherwise>
     CONST_<xsl:value-of select="script:toConstant(string(/task/@name))"/>_<xsl:value-of select="script:toConstant(string(../@name))"/>$<xsl:value-of select="script:toConstant(string(param/@name))"/>
     </xsl:otherwise>
  </xsl:choose>
  <p/>

Except for this xsl script, the C++ parser and .efa files, I cannot find other scripts relating to this kind of identifiers. As I am new in this field, I wanna ask whether this identifier defination is becaused of the xsl script. And, is "$" a special character in xsl which has a specific meaning? If I just do not like this dollar sign, can I change it in the xsl script, then correspondingly modify the efa and C++ scripts?

Upvotes: 1

Views: 1762

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167581

XSLT goes hand in hand with XPath and in XPath the dollar sign is used to start a variable or parameter reference so a meaningful use of the dollar symbol in XSLT is for instance

<xsl:variable name="var1" select="/foo/bar"/>
<xsl:value-of select="$var1"/>

However, in your sample the dollar symbols occurs in text nodes the XSLT outputs and not in XPath expressions, in that case the dollar sign has no special meaning, it is just one of the thousands of Unicode characters an XSLT result can contain. You will need to ask the author of the code or read the spec of the output format to find out whether the dollar sign has any special meaning in that output format.

Upvotes: 4

Related Questions