[oXygen-user] Xpath and Saxon return tabs as text
Sorin Ristache
Fri Sep 5 04:48:17 CDT 2008
Hello Philipp,
Until we add the option for stripping whitespace-only nodes in the
evaluation of expressions on the XPath toolbar you can use the following
XPath 2.0 expression which does the stripping:
//text()[string-length(translate(., ' 	
', '')) > 0]
Regards,
Sorin
Sorin Ristache wrote:
> Hello,
>
> Saxon 9 has an option for stripping whitespace nodes but Oxygen allows
> you to set it only for transformations (Preferences -> XML ->
> XSLT-FO-XQuery -> XSLT -> Saxon -> Saxon-B/SA). If you set the above
> option to strip whitespace nodes and you run an XSLT transform that uses
> the expression //text() you can see that the list of nodes does not
> contain such nodes. In the next version we will add this Saxon 9 option
> for XPath expressions too.
>
>
> Regards,
> Sorin
>
>
> Philipp Steinkrüger wrote:
>> Dear Oxygen-Users,
>>
>> i am having a problem with an indented XML File. The File looks like
>> this:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <TEI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns="http://www.i-d-e.de/ns/1.0">
>> <teiHeader>
>> <fileDesc>
>> <titleStmt>
>> <title>MS Einsiedeln</title>
>> </titleStmt>
>> <publicationStmt>
>> <p>publicationsStmt empty</p>
>> </publicationStmt><sourceDesc>
>> <p>sourceDesc empty</p>
>> </sourceDesc></fileDesc>
>> </teiHeader>
>> <text>
>> <body>
>> <div>
>> <div>
>> <div>
>> <p><c>D</c>ie gotheit iſt beſloſſen<lb/>in dem
>> vater n<ex>atur</ex>elich
>> dar<lb/>vmbe iſt er
>> alvermvgende<lb/>vnd enpfat niht von ite<lb
>> />des<gap reason=""/> er ſelber nit en
>> iſt an<lb/>ſiner go<unclear
>> >tl</unclear>icher macht wan<lb/>ers
>> weſelich i<ex>n</ex> ime vnd
>> an<lb/>ime ſelben beſloſſen hat<space
>> unit="letters" quantity="1"
>> /></p>
>> </div>
>> </div>
>> </div>
>> </body>
>> </text>
>> </TEI>
>>
>> Now, using the following XPath 2.0 expression: //text(), the tabs are
>> returned as text-nodes, for example the first tab before the tag
>> <teiHeader>. In fact, my DTD does not allow #PCDATA inside <TEI>, but
>> the document is validated without any problems. To me this seems kind
>> of schizophrenic, or am I mistaken? Btw: the same file in XMLSpy with
>> its build-in xslt engine as well as MS XML parser with the same xPath
>> expression does not return the tabs as text-nodes.
>>
>> Any ideas?
>> Philipp
>>
>> PS: I am using Oxygen 9.3
More information about the oXygen-user
mailing list