Re: Move elements to preceding parent
I used Catalog to bypass the 503 HTTP errors, and the -expand:off option on Saxon sure helped to remove almost all the extra attributes except the xmlns:xsi. Many thanks. On Mon, Jun 15, 2009 at 4:23 PM, Martin Honnen<Martin.Honnen@xxxxxx> wrote: > Israel Viente wrote: > >> Can you please explain the idea of the line: >>> >>> <xsl:template match="p[preceding-sibling::p[span[@class ne 'chapter'] >>> and not(matches(span[@class ne 'chapter'][last()], '[.?"!]$'))]]"/> >> >> Does it remove the p that has preceding sibling with no ending >> character at the end of the last span? > > Yes, that template matches p elements where the immediately preceding p > element is one with a span child where class is not 'chapter' and where the > last such span element does not end with one of those characters you listed. > As the template is empty it ensure that any such p elements are not copied. > > >> How can I remove the following: >> 1. extra xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" and >> version="-//W3C//DTD XHTML 1.1//EN" inside html element. >> 2. extra profile="" in head element >> 3. extra xml:space="preserve" in p, span and br elements. > > Unfortunately any attempts to transform a document referencing a DTD on > www.w3.org currently fail here with 503 HTTP errors so I can't test myself. > I would assume that the referenced DTD you have defines default values for > those attributes that the XML parser expands and that the identity > transformation copies. According to > http://www.saxonica.com/documentation/using-xsl/commandline.html > Saxon 9 has a command line option > -expand:off > to prevent that from happening so try that if you use Saxon. > > > > -- > > Martin Honnen > http://msmvps.com/blogs/martin_honnen/
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format