Subject: Re: [xsl] Question on search and replace in XSL From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Wed, 04 Apr 2012 17:26:11 -0400 |
Hi - I have an XSL template that's used to format an email message and I need to change the formatting. I did the original formatting, but I haven't touched it in at least 2 years and I'm way beyond rusty with XSL. I'm hoping someone can give me a hand. Here's the issue:
I currently get data from our database with two fields separated by semi-colons. The semi-colons are currently replaced in the template by a <br/>, so the two fields appear one on top of the other. What I need to do is change this so that they appear next to each other in a tabular format. So now the email looks like this, assuming two records one with two fields xxx and yyy and the second with two fields zzz and www:
xxx yyy
zzz www
What I want is:
xxx yyy zzz www
Here's my current code:
.... <tr> <td valign="top" width="180">Adverse Party:</td> <td valign="top" style="font-weight:normal"> <xsl:apply-templates select="APName" /> </td> </tr> ....
<xsl:template name="APNameSplit"> <xsl:param name="text" select="string('')"/> <xsl:param name="find" select="string(';')"/> <xsl:choose> <xsl:when test="$find = ''"> <xsl:value-of select="$text"/> </xsl:when> <xsl:when test="contains($text,$find)"> <xsl:value-of select="substring-before($text,$find)"/> <br/> <xsl:call-template name="APNameSplit"> <xsl:with-param name="text" select="substring-after($text,$find)"/> <xsl:with-param name="find" select="$find"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$text"/> </xsl:otherwise> </xsl:choose> </xsl:template>
<xsl:template match="APName"> <xsl:call-template name="APNameSplit"> <xsl:with-param name="text" select="."/> <xsl:with-param name="find" select="string(';')"/> </xsl:call-template> </xsl:template>
Can anyone give me a hand on how to begin?
-- Public XSLT, XSL-FO, UBL and code list classes in Europe -- May 2012 Contact us for world-wide XML consulting and instructor-led training Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Question on search and replac, Peterson, Melanie S. | Thread | Re: [xsl] Question on search and re, Wolfgang Laun |
Re: [xsl] for-each-group group-by, Michael Kay | Date | Re: [xsl] Question on search and re, Wolfgang Laun |
Month |