Jump to content

Why does the xsl tranformation have a problem with && in my xsl?

Recommended Posts

I am using Saxon to transform my xml to html. The parser is having a problem with the '&&'. I am just starting with xsl transformation. Can anyone give me some insight as to what the problem may be, and possibly how I can get around it? Thanks. The error is:Error on line 23 column 43 of stufferPVB.xsl: SXXP0003: Error reported by XML parser: The entity name must immediately follow the '&' in the entity reference.Failed to compile stylesheet. 1 error detected. <?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:n1="myNamespace"><xsl:output method="html"/><xsl:strip-space elements="ns6:RecentInquiries"/><xsl:template match="PersonVehicleBoatQueryResponse"> <html> <head> <link rel="stylesheet" href="screen2.css" type="text/css" media="screen" /> <link rel="stylesheet" type="text/css" href="ui.jqgrid.css" /> <link rel="stylesheet" id="Link1" type="text/css" href="redmond_ui.css" /> <script src="jquery-1.5.2.min.htm.js" type="text/javascript"></script> <script src="jquery-ui-1.8.16.min.htm.js" type="text/javascript"></script> <script src="grid.locale-en.htm.js" type="text/javascript"></script> <script src="jquery.jqGrid.min.htm.js" type="text/javascript"></script> <script type="text/javascript" src="tabbed.layout.js"></script> <script type="text/javascript" language="javascript"> $(document).ready(function(){ // recent Persons Inquiries var recentPersonData = '<xsl:call-template name="getRecentPersonData"/>' if (recentPersonData != null && recentPersonData != '') { jQuery("#gridRecentPersonInquiry").jqGrid({ xmlReader: { root: "RecentInquiries", row: "RecentPersonNameInquiry", page: "rows>page", total: "rows>total", records: "rows>records", repeatitems: false, id: "OrganizationORIID" }, datatype: 'xmlstring', datastr: recentPersonData, colNames: ['First', 'Middle', 'Last', 'DOB', '######', 'Operator', 'ORI', 'Date', 'Time'], colModel: [ { name: 'PersonGivenName', index: 'PersonGivenName', width: 40 },{ name: 'PersonMiddleName', index: 'PersonMiddleName', width: 20 }, { name: 'PersonLastName', index: 'PersonLastName', width: 40 }, { name: 'PersonBirthDate', index: 'PersonBirthDate', width: 30 }, { name: 'PersonSexCode', index: 'PersonSexCode', width: 20 },{ name: 'Operator', index: 'Operator', width: 25 },{ name: 'OrganizationORIID', index: 'OrganizationORIID', width: 30 },{ name: 'InquiryDate', index: 'InquiryDate', width: 20 },{ name: 'InquiryTime', index: 'InquiryTime', width: 20 } ], forceFit:true, gridview: true, shrinkToFit:true, rowNum: 6, rowList: [6, 12, 18], pager: '#pagerRecentPersonInquiry', caption: 'Recent Person Inquiries ', width: 800, height: 140, sortname: 'Date', sortorder: 'asc', hidegrid: false }); } else { // there are no person recent inquires. do you want to do anything? } }); </script> </head> <body> <header> <h1 id="BodyHeader">Drivers License</h1> </header> <nav> <ul> <li><a href="#tab1">Hit Lists</a></li> <li><a href="#tab2">Collect</a></li> <li><a href="#tab3">Recent Inquiries</a></li> <li><a href="#tab4">DMV</a></li> <li><a href="#tab5">NCIC</a></li> </ul> </nav> <section class="tab" id="tab3"> <p> <div align="center" ID="DivRecentPersonInquiry"> <input type="hidden" name="RecentPersonData" value ="" id="RecentPersonData" tabindex="0" style="display: none;" /> <div id="tableHolder1"> <table id="gridRecentPersonInquiry"></table> <div id="pagerRecentPersonInquiry"></div> </div> </div> <div align="center" ID="DivRecentRegInquiry"> <input type="hidden" name="RecentRegData" value="" id="RecentRegData" tabindex="0" style="display: none;" /> <div id="tableHolder2" align="center"> <table id="gridRecentRegInquiry"></table> <div id="pagerRecentRegInquiry"></div> </div> </div> </p> </section> </body></html></xsl:template> <xsl:template name="getRecentPersonData"> <xsl:if test="ns6:RecentInquiries/ns6:RecentPersonNameInquiry"> <xsl:element name="RecentInquiries"> <xsl:copy-of select="//ns6:RecentInquiries/ns6:RecentPersonNameInquiry"/> </xsl:element> </xsl:if></xsl:template> <xsl:template name="getmoreStuff"><xsl:if test="moreStuff"> <xsl:element name="joe"> <xsl:copy-of select="moreStuff"/> </xsl:element></xsl:if></xsl:template> <xsl:template name="getOtherStuff"> <xsl:copy-of select="n1:otherStuff"/> </xsl:template> <xsl:template match="misc"></xsl:template> </xsl:stylesheet>

Link to post
Share on other sites

Well an XSLT program is an XML document so you need to make sure you write your code following the XML syntax rules. And with XML the ampersand is special, it is used to start a character or entity reference, otherwise it needs to be escaped. So proper XML and XSLT syntax is using


to write two ampersands.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...