2
votes

input xml coding:

 <Table ss:ExpandedColumnCount="21" ss:ExpandedRowCount="55" x:FullColumns="1"
 x:FullRows="1" ss:DefaultColumnWidth="53.0" ss:DefaultRowHeight="14.0">
<Row>
<Cell><Data ss:Type="String">Report Date:&nbsp;02-11-2015 </Data></Cell>
</Row>
<Row>
<Cell ss:StyleID="s62"><Data ss:Type="String">File ID</Data><NamedCell
  ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s59"><Data ss:Type="String">Automation</Data><NamedCell
  ss:Name="_FilterDatabase"/></Cell>
</Row>
<Row>
<Cell ss:StyleID="s63"><Data ss:Type="String">&nbsp; </Data><NamedCell
  ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s73"><NamedCell ss:Name="_FilterDatabase"/></Cell>
</Row>
</Table>

Header declaration in xsl coding:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#xa0;">
]>

We are using the above header declaration in input xsl for replacement of non breaking space(nbsp) with whitespace. but its not working, it again and again shown the below bug. XML Error: The entity "nbsp" was referenced, but not declared.

2
Try using <!ENTITY nbsp "&#160;">Rahul Tripathi

2 Answers

1
votes

If your XML input references the entity (as it does with &nbsp;) then you need to make sure that the XML input declares the entity.

0
votes

You don't need XSLT for this, you can easily just to a text find/replace on your input, replacing &nbsp; with &#160;.

As described though, your input XML isn't valid, it's nothing to do with the XSL- &nbsp; is an HTML entity, not an XML one, so any XML document that uses it must include the entity declaration- this means both the source document and any xsl stylesheet that uses it.