cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Need help with xsl formatting

achukwuka
1-Newbie

Need help with xsl formatting

Gurus,

I am hoping someone out there knows something about xsl style sheet. I am having trouble with the xsl below:

<xsl:template name="break-clist">
<xsl:param name="text"/">
<xsl:choose>
<xsl:when test="contains($text,',')">
<xsl:variable name="this-item"&lt;br"/>select="normalize-space(substring-before($text,','))"/>
<xsl:if test="$this-item">
<replacespart>
<xsl:value-of select="$this-item"/">
</replacespart>
</xsl:if>
<xsl:call-template name="break-clist">
<xsl:with-param name="text" select="substring-after($text,',')"/">
</xsl:call-template>
</xsl:when>
<xsl:when test="normalize-space($text)">
<replacespart>
<xsl:value-of select="concat($this-item,$text)"/">
</replacespart>
</xsl:when>
</xsl:choose>
</xsl:template>

Basicall, I am getting an error that says "the variable this-item is not declared" in the concat statement. I am tyring to concatenate the value of this-item with the value of text and display them on one line separated by a comma. The variable this-item is declared and initialized in the upper section of the code and I need to referrence it in the lower portion where I am concatenating the two.


Any help is appreciated.

Thanks

Alexius C. Chukwuka
IT Analyst, PDP Systems
John Deere Power Systems
Product Engineering Center
2 REPLIES 2

Hi Alexius,

Try moving the variable before the choose element

<xsl:template name="break-clist">
<xsl:param name="text"/">
<xsl:variable name="this-item" select="&lt;br"/>"normalize-space(substring-before($text,','))"/>
<xsl:choose>
<xsl:when test="contains($text,',')">
<xsl:if test="$this-item">
<replacespart>
<xsl:value-of select="$this-item"/">
</replacespart>
</xsl:if>
<xsl:call-template name="break-clist">
<xsl:with-param name="text" <br="/>select="substring-after($text,',')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="normalize-space($text)">
<replacespart>
<xsl:value-of select="concat($this-item,$text)"/">
</replacespart>
</xsl:when>
</xsl:choose>
</xsl:template>

Regards,

Murugesh Dhakshinamoorthy
Mailto: murugesh.d@tcs.com
Website:

The dash may be an invalid character. Try an underscore (this_item).



Patrick Williams | Sr. Applications Engineer | Engineering Systems |
Steelcase Inc. | 616.698.4078 | My Site
<">http://my.steelcase.com/Person.aspx?accountname=NA\PWILLIA3>






Top Tags