xsl-list
[Top] [All Lists]

Re: [xsl] Move elements to preceding parent

2009-06-15 11:10:27
I have another question regarding this.
I want to be able to control the valid ending paragraph characters
from a config file in xml.
How can I read the set [.?"!] from an external xml? - say something like:
<ParagraphTerminator>
                <Char>.</Char>
                <Char>?</Char>
                <Char>&quot;</Char>
                <Char>!</Char>
</ParagraphTerminator>

or any other xml representation that will be easy to read as the set
in the regular expression.

Thanks, Viente

On Mon, Jun 15, 2009 at 4:23 PM, Martin 
Honnen<Martin(_dot_)Honnen(_at_)gmx(_dot_)de> wrote:
Israel Viente wrote:

Can you please explain the idea of the line:

 <xsl:template match="p[preceding-sibling::p[1][span[(_at_)class ne 
'chapter']
and not(matches(span[(_at_)class ne 'chapter'][last()], 
'[.?&quot;!]$'))]]"/>

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/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--