[Home]  [List]  [News]  [Docs]  [FAQ]  [Downloads]  [Resources]  [About]
Search :
/Home /List

list4xt : Mailing list for the XT users community.

[list4xt] Re: Regexpr or not no Regexpr. ( Re: Support for omquery (XPath query) )

Subject: [list4xt] Re: Regexpr or not no Regexpr. ( Re: Support for omquery (XPath query) )

User: Website

From: Paul Tchistopolskii (pault12@pacbell.net)
Date: 04/06/2000 - 08:35


> I'l write this stuff anyway in next 2 weeks, but maybe I'm reinventing
> the wheel here ?
>
> the original reference (a guy from Japan?) does it for me.
> I can pass in a path as param and have the response returned.
> Have a look at it Paul.

Well ... I think you got that url from Eric who got it from me ;-)
I'm aware of omquery for a couple of months and I think that
I understand what it does ( for sure, if writing simple wrapper in
Java around om/dom query you can produce the standalone
grep in one day ).

But this is not what I'm talking about. Consider the more general
usecase when you have a stylesheet and you want to provide
a *node*set* ( like "<a>some<b>node</b></a>" ) as a parameter
to this stylesheet.

The only 'legal' way to provide a node-set into stylesheet is
with document() ( but this is not efficient and sometimes not
even possible , when node-set to-be-provided is generated
at 'earlier' stage ).

So the solution is to provide that node-set in form of string
and then deserialize the string into node-set.

om/domquery *could* be used for deseralization, but
I think it is overkill.

The way I see it is to use String->RTF ( xt:rtf("string")) and
then RTF->nodeset ( xt:node-set( rtf ) )

String->RTF is what I'm planning to write and this could be
done without utilization of heavy om/dom query, I think.

> I don't seem to have kept the
>
>
> I'm not sure about regular expressions at all. I can not imagine any
> usecase for regular expressions if the schema of XML file is
> reasonable.
> I mean that if some parts of the content are not already separated
> by markup ( this allows XPath to do everything ), trying to separate
> those parts with the help of regular expressions is a logical hack.
> Am I wrong?
>
> I'l be glad to get a usecase which will show that we need regexprs on
> a 'good' XML, because I may not see it ... Do you ?
>
> There have been calls for it on the Mulberrytech list.

.... none of them were reasonable from my point of view, thats
why I'm trying to understand why should somebody 'corrupt'
the XML-based dataflow ...

I think that such 'corruption' is better to be done *not* with regular
expressions but with appropriate 'formatting objects' .

I mean that if, for example, we need to capitalize first character in some
word, it is better to write trivial rendering layer which will make this
capitalization, instead of using regular expressions in XSL stylesheet,
hunting for the first character of the word. That means that that
capitalization task will be delegated no that layer ( and that layer
could written in XSL, but with heavy usage of native Java code ==
extensions) :

<xsl:template match="cap-para">
    <next-layer:capitalize-first-word>
    <xsl:apply-templates>
    </next-layer:capitalize-first-word>
</xsl:template>

 ( Actually, I'm getting rid of namespaces, so it will be
<next-layer-capitalize-first-word> ,
but I think this design is 'better' than regular expressions in the XSLT core ).

Is there some usecase which strongly forces regular expressions ?

Rgds.Paul.

--
Mailing list for the XT users community.     (http://perfectscoremortgages.com)
(mailto:list4xt-request@4xt.org?Subject=unsubscribe to unsubscribe)



Archive générée par hypermail 2b28 le 06/11/2001 - 11:46 CET

webmaster@4xt.org