[xsl] Response to G Ken Holman re Question on search and replace in XSL

Subject: [xsl] Response to G Ken Holman re Question on search and replace in XSL
From: "Peterson, Melanie S." <MPeterson@xxxxxxxxxxxxxxx>
Date: Tue, 10 Apr 2012 14:58:24 +0000

Thanks so much for your response.  This is something I never would've figured
out on my own.  I've implemented your suggestions, but I'm getting an error
message and I'm hoping it's a quick fix.  Here's the code I've got:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";

<xsl:output method="html" indent="yes" omit-xml-declaration="yes" />

....other HTML and  <xsl:apply-templates> sections.....
<xsl:apply-templates select="APName" />
....more HTML and <xsl:apply-templates> sections

...other <xsl:template> sections...
<xsl:template match="APName">
    Input value: "<xsl:value-of select="."/>"

<!--create groups of three using the tokenized input-->
<xsl:for-each-group select="tokenize(.,';')" group-by="( position() - 1 ) idiv
  <!--each group produces a row-->
    <td valign="top" width="180"></td>
    <!--the members of the group make up the remaining columns-->
    <xsl:for-each select="current-group()">
        <xsl:value-of select="."/>
...more <xsl:template> sections

I'm getting an error message on the <xsl:for-each-group> statement:
'xsl:for-each-group' is not a recognized extension element.  I did some
research and found some suggestions that this would work better with version
1.0.  When I try that, though, the error message I get is:
'xsl:for-each-group' cannot be a child of the 'xsl:template' element.  So,
once again, I'm stuck.  Perhaps it would help if I explain how this code is
being used.  It's called from an ASP.Net application, and it's used to
generate an HTML document which is then sent via an SMTP server as an email.
The users are using Windows 7 and viewing the application in IE9.  However,
they *never* view the output of this XSL document; it's just sent as an email
behind the scenes.  The .Net code is as follows:

protected override void PrepareMessageBody()
                        using (DataSet data =
DataGateway.getNYConflictNoticeInformation(RequestID)) //this calls a SQL
Server stored procedure; the DataSet called data contains various fields,
including the aaa;bbb;ccc;ddd;eee;fff field that we've been dealing with.
                                data.DataSetName = "CMIntake";
                                data.Tables[0].TableName =
                                XmlDataDocument xmldoc = new

                                XslTransform xslt = new XslTransform();
                                string xsltfile = this.TemplatePath +
//the xsltfile is the file we've been dealing with.  There are a number of
<xsl:apply-templates> sections and a number of <xsl:template> sections, but
we've only been dealing with the one that formats APName

                                TextWriter writer = new StringWriter();
                                xslt.Transform(xmldoc, null, writer, null);

                                Message.Body = writer.ToString();
                                Message.BodyFormat = MailFormat.Html; // This
Message is later sent as an email


I hope this helps.  If this *isn't* a quick fix, *please* let me know and I'll
just approach this from a different perspective, i.e., I'll just build an HTML
document within the C# code and forget about XSL altogether.

Thanks 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

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

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

Current Thread