Re: [xsl] [XPath] matching elements which satisfy a specific content model

Subject: Re: [xsl] [XPath] matching elements which satisfy a specific content model
From: Tobias Reif <tobiasreif@xxxxxxxxxxxxx>
Date: Mon, 13 Jan 2003 13:36:40 +0100
David Carlisle wrote:


It would make some things shorter (but I still don't think that the kind
of test in your exampleis often needed, your expanded example didn't
show a need for it as it didn't show what you wanted in the other case)


When there is no title? Then I want no heading element; I'm testing it with xsl:if.

But again: In general, I think it should be possible to express simple content models with simple XPaths. You don't have to agree.


However I think that actually this is making things conceptually twice
as complicated. XPath is a language for specifying certain types of
paths through an XML tree. Some simple cases are very simple and others
are more verbose.


Not too verbose for you (if I understood you correctly), but too verbose for me :)


DTD content model syntax is similarly a language for specifying certain
kinds of paths through trees. The set of things that are simple and/or
verbose in that syntax is unsurprisingly different.


It didn't say the difference would surprise; I just said that simple things should be simple in XPath, and that this *could* be inspired by DTD content model syntax.


So it's not surprising that there are some things that are easier to say
in DTD content models than in Xpath,


Sure it's not surprising.

but I don't think the solution is
to just have a combined language,


Not a combined language.

Just one additional function in XPath. Think about it without thinking of DTDs :)

that would again make some things look
a bit simpler but lead to even more complexity and lots of extra rules
to tie down the semantics.


We choose XSLT over C in many cases :)

It could be specified with one line of EBNF, and one tiny para of text:
~
sequence: foo, bar
group: ()
one or more: +
zero or more: *
zero or one: ?
...

In a dtd foo means the element with name
"foo" in Xpath foo means the element with name foo in no namespace.
What would "foo" mean in your proposal?


Since it's a proposed XPath function, why would it mean something different from what it means in XPath?

The DTD syntax example was to describe the actual content model, and to show how terse, elegant, and short it can be expressed.

Sure in my proposal foo means the exact same thing as it does anywhere in XPath; nothing to do with DTDs, which as you know don't know namespaces.

Either you end up with something
that looks like DTD syntax but has very different namespace conventions,


That would be no problem at all, since they would be the same as with all other XPath functions.


or you have to introduce a whole new set of namespace unaware element
name tokens into the Xpath language.


why?

Either could be specified easily
enough but it isn't really a simplification.


It is a potential simplification for the XSLT author.

Not for you maybe, but for me; A huge simplification in fact. You don't have to adopt my view, but you could respect it, as I respect yours. I don't want to tell you that you need content-model(); but I want to tell you that I'd be happy to be able to use it, without being told that "it isn't really a simplification".

The syntax could look familiar to those who write DTDs, but hat's the only thing my proposal has to do with DTDs. I do not expept the function to accept arbitrary DTD snippets.

Tobi


--


Vim users               donate.
http://iccf-holland.org/donate.html

Web developers           check.
http://www.pinkjuice.com/check/


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread