« Return to Thread: WebTestReport.xsl -- add template to parse out line breaks for step

Re: WebTestReport.xsl -- add template to parse out line breaks for <testInfo> step

by Michael Habbert-3 :: Rate this Message:

Reply to Author | View in Thread

Hi Kelcy,

I suggest you patch your local WebTestReport.xsl file (look inside your
WEBTEST_HOME directory).
We did it, to add a special handling for our ticket-system.

cheers

Michael

Kelcy Monday wrote:

> I would like to parse out and render line breaks in string that is
> passed through the <testInfo> step.  I have a basic idea of how to do
> this, but I keep getting stuck on implementation.
>
> Here is the code that I have:
>
>         <xsl:template match="parameter[@name = 'type' and
> @value='reportSettings']" mode="replaceLineBreaks"
>                       name="replaceLineBreaks">
>           <xsl:param name="string" select="parameter[@name =
> 'info']/@value" />
>           <xsl:choose>
>             <!-- if the string contains a line break... -->
>             <xsl:when test="contains($string, ' ')">
>               <!-- give the part before the line break... -->
>               <xsl:value-of select="substring-before($string, ' ')" />
>               <!-- then a br element... -->
>               <br />
>               <!-- and then call the template recursively on the rest of
> the
>                    string -->
>               <xsl:call-template name="replaceLineBreaks">
>                 <xsl:with-param name="string"
>                                 select="substring-after($string,
> ' ')" />
>               </xsl:call-template>
>             </xsl:when>
>             <!-- if the string doesn't contain a line break, just give its
>                  value, followed by a br element -->
>             <xsl:otherwise>
>               <xsl:value-of select="$string" /><br />
>             </xsl:otherwise>
>           </xsl:choose>
>         </xsl:template>
>
> My biggest problem is figuring out where to put the template and where
> to call it.  I also am not sure if my /match/ string is appropriate.
>
> Kelcy Monday
_______________________________________________
WebTest mailing list
WebTest@...
http://lists.canoo.com/mailman/listinfo/webtest

 « Return to Thread: WebTestReport.xsl -- add template to parse out line breaks for step