Subject: RE: [xsl] Outputting newline to XSL document From: cknell@xxxxxxxxxx Date: Fri, 01 Sep 2006 09:52:08 -0400 |
There is a lot of confusing matter in your message. If you are having trouble with an XSLT stylesheet, we generally need at least two things to help: The problem stylesheet (or a model with the relevant portions included) - provided. The document you are transforming (or a model with the relevant portions included) - missing. I am also confused about the namespaces in your document. The "regexp" namespace is declared, and listed in "exclude-result-prefixes" attribute value, but it appears nowhere else in the stylesheet. Have you left out something relevant that we need to see in order to assist? Your xsl:output declares that you will be creating an HTML document, but suddenly in the middle of the stylesheet with no explanation an xsl:fo element pops up. Have you unwittingly combined two stylesheets with different purposes? Finally, out of nowhere, a Transact/SQL stored procedure appears. We are left to wonder why it's there and can only surmise that it is used somehow to produce the XML you hope to transform with the XSLT stylesheet. But there's nothing in the stored procedure that indicates it is returning data in XML format, and we have no clue as to what the XML document you hope to transform looks like. If you can address these issues (particularly we need a look at your XML) maybe we can be of some help. -- Charles Knell cknell@xxxxxxxxxx - email -----Original Message----- From: Peterson, Melanie S. <MPeterson@xxxxxxxxxxxxxxx> Sent: Thu, 31 Aug 2006 15:46:21 -0400 To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Subject: [xsl] Outputting newline to XSL document Hi all, I'm hoping you can tell me what I'm doing wrong. Here's the deal: I'm working on an app that was created by someone else who is (natch!) no longer at the company. The app generates an email via an xsl file. I've put *** around the pertinent portions: START OF XSL FILE ***<!DOCTYPE newline SYSTEM "cr.dtd"> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:regexp="http://exslt.org/regular-expressions" exclude-result-prefixes="regexp" xml:space="preserve" >*** <xsl:output method="html" indent="yes" omit-xml-declaration="yes" /> <xsl:template match="/"> <table style="background-color:#8D9E92; font-family:verdana; color:white; font-weight:bold;" width="100%"> <tr><td width="300"> Client Matter Intake Email Notice </td></tr> <tr><td> </td></tr> </table> <br /> <span style="font-size:x-small;font-family:verdana;font-weight:normal; color:black;"> <xsl:apply-templates select="CMIntake"> </xsl:apply-templates> </span> <table style="background-color:#8D9E92; font-family:verdana; color:white; font-weight:bold;" width="100%"> <tr><td align="center"> End of Notice </td></tr> </table> </xsl:template> <xsl:template match="NYConflictNotice"> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <br />We have been asked to provide legal services to client <span style="font-weight:bold"><xsl:apply-templates select="ClientName" /></span> in connection with the following matter: <br /> <br /> <table style="font-family:verdana;font-weight:bold;font-size:x-small"> <tr><td colspan="2"></td></tr> <tr> <td width="180">Request ID:</td> <td style="font-weight:normal"><xsl:apply-templates select="RequestID" /> </td> </tr> <tr> <td width="180">Matter Name:</td> <td style="font-weight:normal"><xsl:apply-templates select="MatterName" /> </td> </tr> <tr> <td width="180" style="vertical-align:top">Matter Description:</td> <td style="font-weight:normal" width="450"> <xsl:apply-templates select="MatterDescription" /> </td> </tr> <tr> ***<td width="180">Adverse Party:</td> <td style="font-weight:normal"> <xsl:apply-templates select="APName" /> </td> </tr> <tr> <td width="180" style="vertical-align:top">Related Party:</td> <td style="font-weight:normal"> <xsl:apply-templates select="RPName1" />*** <br /> <xsl:value-of select="RPName2" /> </td> </tr> </table> <br /><br /> If there is a conflict or concern with the proposed representation, please call <span style="font-weight:bold"><xsl:apply-templates select="BillingPartner" /></span>. <br /><br /><br /><br /> Regards. <br /><br /> Client Matter Intake <br /><br /><br /><br /><br /><br /><br /><br /> </fo:root> </xsl:template> <xsl:template match="RequestID"> <xsl:value-of select="." /> </xsl:template> <xsl:template match="ClientName"> <xsl:value-of select="." /> </xsl:template> <xsl:template match="MatterName"> <xsl:value-of select="." /> </xsl:template> <xsl:template match="MatterDescription"> <xsl:value-of select="." /> </xsl:template> <xsl:template match="APExist"> <xsl:value-of select="." /> </xsl:template> ***<xsl:template match="APName"> <xsl:value-of select="." /> </xsl:template> <xsl:template match="RPName1"> <xsl:value-of select="." /> </xsl:template>*** <xsl:template match="RPName2"> <xsl:value-of select="." /> </xsl:template> <xsl:template match="BillingPartner"> <xsl:value-of select="." /> </xsl:template> </xsl:stylesheet> END OF XSL FILE I've been asked to change how the APName and RPName1 fields display. These two items are each a list of names, and my boss wants them to display in columns. First challenge: getting them to output with a carriage return after each item. The data comes in from a SQL stored procedure (see *** for pertinent sections): START OF SP SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO ALTER PROCEDURE [dbo].[getNYConflictNoticeInformation] @RequestID as int AS Declare @IsNewClient as boolean Select @IsNewClient = IsNewClient From ConflictCheckRequest Where RequestID = @RequestID DECLARE @vcharAPList varchar(2000) DECLARE @CursorVar1 CURSOR DECLARE @dummy varchar(2000) --SET @vcharAPList = '' ***SET @CursorVar1 = CURSOR SCROLL DYNAMIC FOR SELECT AdverseParty FROM AdverseParty WHERE RequestID = @RequestID OPEN @CursorVar1 FETCH NEXT FROM @CursorVar1 INTO @vcharAPList WHILE @@FETCH_STATUS = 0 BEGIN FETCH NEXT FROM @CursorVar1 INTO @dummy IF @@FETCH_STATUS <> 0 BREAK UPDATE AdverseParty SET @vcharAPList = @vcharAPList + '&cr; ' + RTRIM(LTRIM(AdverseParty)) WHERE CURRENT OF @CursorVar1 END CLOSE @CursorVar1 DEALLOCATE @CursorVar1 DECLARE @vcharIPList varchar(2000) DECLARE @CursorVar2 CURSOR SET @vcharIPList = '' SET @CursorVar2 = CURSOR SCROLL DYNAMIC FOR SELECT InterestedParty FROM InterestedParty WHERE RequestID = @RequestID OPEN @CursorVar2 FETCH NEXT FROM @CursorVar2 INTO @vcharIPList WHILE @@FETCH_STATUS = 0 BEGIN FETCH NEXT FROM @CursorVar2 INTO @dummy IF @@FETCH_STATUS <> 0 BREAK UPDATE InterestedParty SET @vcharIPList = @vcharIPList + '&cr; ' + RTRIM(LTRIM(InterestedParty)) WHERE CURRENT OF @CursorVar2 END CLOSE @CursorVar2 DEALLOCATE @CursorVar2*** CREATE TABLE #TEMP(RequestID int, APList varchar(2000), IPList varchar(2000)) INSERT INTO #TEMP VALUES(@RequestID, @vcharAPList, @vcharIPList) If @IsNewClient = 1 Select R.RequestID, Coalesce(T.tkfirst + ' ', '') + Coalesce(T.tklast, '') as [BillingPartner], C.clname1 as ClientName, M.mname as MatterName, M.mdescription as MatterDescription, case when RP.APExist = 1 then 'Yes' else 'No' end 'APExist', case when Te.APList = '' or Te.APList is null then 'N/A' else Te.APList end 'APName', case when Te.IPList = '' or Te.IPList is null then 'N/A' else Te.IPList end 'RPName1' From ConflictCheckRequest R left join Client C On R.cltid = C.cltid Left Join Matter M On M.RequestID = R.RequestID left join NYACC001.son_db.dbo.timekeep T On M.mbillaty = T.tkinit left join RelatedParties RP On RP.RequestID = R.RequestID left outer join #TEMP Te On Te.RequestID = R.RequestID Where M.RequestID = @RequestID Else Select R.RequestID, Coalesce(T.tkfirst + ' ', '') + Coalesce(T.tklast, '') as [BillingPartner], C.clname1 as ClientName, M.mname as MatterName, M.mdescription as MatterDescription, case when RP.APExist = 1 then 'Yes' else 'No' end 'APExist', case when Te.APList = '' or Te.APList is null then 'N/A' else Te.APList end 'APName', case when Te.IPList = '' or Te.IPList is null then 'N/A' else Te.IPList end 'RPName1' From ConflictCheckRequest R left join nyacc001.son_db.dbo.client C On R.clnum = C.clnum Left Join Matter M On M.RequestID = R.RequestID left join NYACC001.son_db.dbo.timekeep T On M.mbillaty = T.tkinit left join RelatedParties RP On RP.RequestID = R.RequestID left outer join #TEMP Te On Te.RequestID = R.RequestID Where M.RequestID = @RequestID DROP TABLE #TEMP GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO END OF SP I've been experimenting with appending various special character sequences to each item. Here's an sample output from the sp: RequestID BillingPartner ClientName MatterName MatterDescription APExist APName RPName1 86 JOHN DOE ACME General xxx Yes BBB&cr; CCC N/A I've tried outputting the data surrounded by <tr><td></td></tr> or by <br></br>, or followed by \n\r, by , by , by <br>, and by <br />. I've tried <xml:text> tags around the output items, xml:space="preserve", as well as using xsl:analyze-string with regex and a for-each loop, but this analyze-string seems to be a feature of XML 2.0 - at least I can't get it to work with 1.0. Currently, I've put a DTD declaration in the xsl file and I've included a DTD file called "cr.dtd" into my Visual Studio solution: <!DOCTYPE newline [<!ENTITY cr "<xsl:text> </xsl:text>">]> When I get to the point in the app where the email is to be sent, I get an error message: There is an invalid character in the given encoding. Line 1, position 10. I'm using .Net 1.1, XML 1.0, IE 6 and Visual Studio 2003. Upgrading to Net 2.0 and XML 2.0 is not the way I want to go because I'm not sure what else will be affected by such a conversion, so I'd rather find a solution to this within XML 1.0's abilities. So - do you know why I'm getting this error message? I'm totally new to XML, XSL, and DTD, so I've probably missed some crucial step somewhere, but I don't know what it is. One clue is that Visual Studio doesn't seem to understand what the DTD file is; it gives it a default icon in the Solution Explorer instead of a "DTD" icon. So do I have to import a namespace somewhere or something? Alternatively, do you know of another way to accomplish what I'm trying to do? Halp!! Any ideas would be greatly appreciated! Melanie S. Peterson Systems Programmer 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] Questions regarding match, Michael Kay | Thread | [xsl] XSL-List Guidelines, Mulberry Technologie |
RE: [xsl] Questions regarding match, Michael Kay | Date | [xsl] XSL-List Guidelines, Mulberry Technologie |
Month |