|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
> hi
> i have a stylesheet that should remove unnecessary tags > with non-breakable-spaces like '<p> </p>' > my input file is XP-Word-HTML which is >completely invalid :) > so I JTidy it and convert it to xhtml with UTF-8 encoding > next i want to use my stylesheet to filter out all unnecessary tags > including empty elements & those with nbsps. > > i've tried: > > (1) test="normalize-space(.)" on each p node > > and > > (2) declaring nbsp as an ENTITY and then finding it between p tags > > test="p=nbsp" > > but neither works - i still get <p>
O;</p> in my output-xml > > any ideas ? > ez & thanks for replys > hirez > > STYLESHEET > ------------------------------------------------------------------------- > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE stylesheet [ > <!ENTITY nbsp "*"> > ]> > <xsl:stylesheet > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > <xsl:output method="xml" indent="no" encoding="UTF-8"/> > > <!-- p elements: remove empty tags --> > <xsl:template match="p"> > <xsl:choose> > <xsl:when test="not(normalize-space(.))"> > <empty> > <xsl:apply-templates/> > </empty> > </xsl:when> > <xsl:otherwise> > <content> > <xsl:apply-templates/> > </content> > </xsl:otherwise> > </xsl:choose> > </xsl:template> > </xsl:stylesheet> > > ------------------------------------------------------------------- > INPUT FILE > is an xhtml file > (formerly winXPword-html after a JTidy) > looks something like this if i view it in UTF-8: > > <p>valid text</p> > > <p> </p> > > <p>valid text</p> > ----------------------------------- > > BUT looks like this if i view it > in ISO-8859-1 (latin 1) > whats this ? (Acirc and a space ?) > > <p>valid text</p> > > <p>Â </p> > > <p>valid text</p> > ----------------------------------------- > > OUTPUT FILE > my ouput looks like this: > > <?xml version="1.0" encoding="UTF-8"?> > .... > <p>valid text</p> > > <p> </p><p> </p> > > <p>valid text</p> > .... |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > encoding |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|