RE: [xsl] Matching " within a variable as:item()*

Subject: RE: [xsl] Matching " within a variable as:item()*
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 5 Jan 2010 13:44:16 -0000
> Within the VariableAsItem I was creating the "ZXZX" as 
> follows due to a lazy cut and paste from previous code that 
> was selecting the value of a variable rather than just text.
> 
>             <xsl:text>"</xsl:text>
>             <xsl:value-of select="'ZXZX'"/>
>             <xsl:text>"</xsl:text>

This creates a sequence of three text nodes, which you then process
one-at-a-time when you do

<xsl:for-each select="$VariableAsItem">
  <xsl:analyze-string select=".">

Adjacent text nodes are concatenated only when the text nodes are used to
form the content (string value) of another node.

So if you want them concatenated, you can do:

  <xsl:value-of>
     <xsl:text>"</xsl:text>
     <xsl:value-of select="'ZXZX'"/>
     <xsl:text>"</xsl:text>
  </xsl:value-of>

This is rarely needed, but it's useful to be aware of the possibility.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

Current Thread