Subject: [xsl] Response to Wolfgang Laun, Michele R Combs and G Ken Holman re Question on search and replace in XSL From: "Peterson, Melanie S." <MPeterson@xxxxxxxxxxxxxxx> Date: Mon, 9 Apr 2012 18:35:44 +0000 |
First of all, let me say that I deeply appreciate the help you've given me so far and I do know this is all volunteer effort on your part. You guys are the best, and I apologize if I'm not being clear. What you've told me so far has helped me to get much closer to solving my problem, so I for one am happy! Let me tell you where I am, and try to explain more clearly what I'm trying to accomplish. The input for the XML can be any number of triads of information. So for example, the input could be aaa;bbb;ccc The input could also be aaa;bbb;ccc;ddd;eee;fff Every three items needs to be formatted into a set of 3 columns. So the first example needs to look like this: <tr><td valign="top" width="180"></td><td valign="top" width="180">aaa</td><td valign="top" width="180">bbb</td><td valign="top" width="180">ccc</td></tr> The second example needs to look like this: <tr><td valign="top" width="180"></td><td valign="top" width="180">aaa</td><td valign="top" width="180">bbb</td><td valign="top" width="180">ccc</td></tr> <tr><td valign="top" width="180"></td><td valign="top" width="180">ddd</td><td valign="top" width="180">eee</td><td valign="top" width="180">fff</td></tr> There can be any number of triads of this type, one, two fifteen, I can't predict. To complicate things further, I cannot rely on there always being three pieces of information in each triad. So, I might have aaa;;ccc which needs to look like this: <tr><td valign="top" width="180"></td><td valign="top" width="180">aaa</td><td valign="top" width="180"></td><td valign="top" width="180">ccc</td></tr> As I said, based on your input, I've gotten closer. Here's what I have so far: <tr> <td valign="top" width="180"></td> <xsl:apply-templates select="APName" /> </tr> <xsl:template name="APNameSplit"> <xsl:param name="text" select="string('')"/> <xsl:param name="find" select="string(';')"/> <xsl:choose> <xsl:when test="$find = ''"> <td valign="top" width="180"> <xsl:value-of select="$text"/> </td> </xsl:when> <xsl:when test="contains($text,$find)"> <td valign="top" width="180"> <xsl:value-of select="substring-before($text,$find)"/> </td> <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> However, the output I get with this is: <tr><td valign="top" width="180"></td><td valign="top" width="180">aaa</td><td valign="top" width="180">bbb</td><td valign="top" width="180">ccc</td><td valign="top" width="180">ddd</td><td valign="top" width="180">eee</td>fff</tr> Two problems: I haven't figured out how to create a new row (<tr></tr>) after <td>ccc</td>, and fff is showing up without its own <td></td> cell. Re the new row, I can insert a symbol other than a semi-colon after ccc. If I inserted a | symbol, let's say, I'd need to know how to convert that into a <tr></tr> pair in XSL. So the input in a two-triad scenario would be aaa;bbb;ccc|ddd;eee;fff Further, I haven't even begun to address the issue with cells that are blank. Hopefully, this is clearer. Thank you so much for all your help! Melanie Peterson Project Coordinator/Systems Developer Kramer Levin Naftalis & Frankel LLP 1177 Ave. of the Americas New York, NY 10036 212-715-7738 Melanie S. Peterson Project Coordinator/Systems Developer Kramer Levin Naftalis & Frankel LLP 1177 Avenue of the Americas New York, New York 10036 Tel: 212-715-7738 Fax: 212-715-8000 Email: MPeterson@xxxxxxxxxxxxxxx <http://www.kramerlevin.com/> This communication (including any attachments) is intended solely for the recipient(s) named above and may contain information that is confidential, privileged or legally protected. Any unauthorized use or dissemination of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender by return e-mail message and delete all copies of the original communication. Thank you for your cooperation.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XPath preceding, Rick Quatro | Thread | Re: [xsl] Response to Wolfgang Laun, G. Ken Holman |
RE: [xsl] XPath preceding, Rick Quatro | Date | Re: [xsl] Response to Wolfgang Laun, G. Ken Holman |
Month |