Simple SlideShow

Mega Menu

PullDown menu(exei HTML)

3D icon menu

Σάββατο 12 Δεκεμβρίου 2015

How to handle HTML entity nbsp in XSLT

I am trying to convert an HTML file into XML file using XSLT (Using Oxygen 9.0 for transformation).




When I configure and run the XSLT transformation with the HTML file then Oxygen outputs
The entity 'nbsp' was referenced,but not declared.
My input html file is:
<div><span>&nbsp;some text</span></div>
Note: I want to know how handle that entity only using the XSLT, I don't want to make any changes to the input file.







2 Answers


 
You could use XML Entities to create an XML file that defines the nbsp entity, and includes the (broken) XML fragment.
For example, assume that your fragment is saved as a file called: "invalid.xml"
<div><span>&nbsp;some text</span></div>
Create an XML file like this:
<!DOCTYPE wrapper [
   <!ENTITY nbsp "&#160;">
   <!ENTITY invalid-xml-document SYSTEM "./invalid.xml">
]><wrapper>
&invalid-xml-document;</wrapper>
When it that file gets parsed, it will have defined the nbsp entity, include the content from the "invalid.xml", and resolve the nbsp entity properly. The result is this:
<wrapper>
  <div>
    <span> some text</span> 
  </div>
</wrapper>
Then, just adjust your XSLT to accomodate the new document element (in this example the element <wrapper>).





As far as I know, you're going to need to make changes to the input file.
Either by changing your &nbsp; to &#160; or by declaring a custom doctype that will do the conversion for you:
<!DOCTYPE doctypeName [
   <!ENTITY nbsp "&#160;">
]> 
This is because &nbsp; isn't one of XMLs predefined entities.

http://stackoverflow.com/questions/9126999/how-to-handle-html-entity-nbsp-in-xslt-without-changing-the-input-file




Page Navigation

3D Text

O KΩΔΙΚΑΣ HTML:

3D Text ΕΔΩ ΓΡΑΨΕΤΕ ΤΟ ΚΕΙΜΕΝΟ ΣΑΣ

Marquee Text-Icons

Thomasgrm.Blogger.gr

FlashVortex Banner

Tab Widget

ΕΔΩ ΤΟ ΠΕΡΙΕΧΟΜΕΝΟ ΤΟΥ ΤΑΒ 1
ΕΔΩ ΤΟ ΠΕΡΙΕΧΟΜΕΝΟ ΤΟΥ ΤΑΒ 2
ΕΔΩ ΤΟ ΠΕΡΙΕΧΟΜΕΝΟ ΤΟΥ ΤΑΒ 3

Tab Widget 2

ΕΔΩ ΤΟ ΠΕΡΙΕΧΟΜΕΝΟ ΤΟΥ ΤΑΒ 1
ΕΔΩ ΤΟ ΠΕΡΙΕΧΟΜΕΝΟ ΤΟΥ ΤΑΒ 2
ΕΔΩ ΤΟ ΠΕΡΙΕΧΟΜΕΝΟ ΤΟΥ ΤΑΒ 3
ΕΔΩ ΤΟ ΠΕΡΙΕΧΟΜΕΝΟ ΤΟΥ ΤΑΒ 4

Carousel POST SLIDER

Slideshow

  • ΑΛΟΝΗΣΟΣ-1

    ΑΛΟΝΗΣΟΣ-1

  • ΑΛΟΝΗΣΟΣ-4

    ΑΛΟΝΗΣΟΣ-4

  • ΑΛΟΝΗΣΟΣ-5

    ΑΛΟΝΗΣΟΣ-5

  • ΑΛΟΝΗΣΟΣ-11

    ΑΛΟΝΗΣΟΣ-11

  • ΣΚΙΑΘΟΣ-22

    ΣΚΙΑΘΟΣ-22

  • ΣΚΙΑΘΟΣ-23

    ΣΚΙΑΘΟΣ-23

  • ΣΚΙΑΘΟΣ-1

    ΣΚΙΑΘΟΣ-1

  • ΣΚΙΑΘΟΣ-4

    ΣΚΙΑΘΟΣ-4

  • ΣΚΙΑΘΟΣ-20

    ΣΚΙΑΘΟΣ-20

- See more at: http://gadgetsforblogs1.blogspot.gr/2015/01/slideshow-with-thumbnails.html#more

BACKGROUND SLIDER

Menu Posts Vertical - ACCORDION MENU