Are you stuck with XSLT 1.0 or is XSLT 2.0 available to you?
Your current code is already creating two columns ... do you want the
new code to create three columns or an embedded table of two columns
in the second column of your old code?
Is the current APName something like the following?
<APName>field 1; field 2</APName>
If so, then how do you want the final output with "Adverse Party:" included?
. . . . . . . . Ken
At 2012-04-04 21:17 +0000, Peterson, Melanie S. wrote:
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(_at_)CraneSoftwrights(_dot_)com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--