Re: [xsl] inserting a child element while honoring the parent element's content model

Subject: Re: [xsl] inserting a child element while honoring the parent element's content model
From: "Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 22 Feb 2023 20:37:47 -0000
Hi Vincent, Wendell,

I am interested in understanding how regular expressions are used to
check/enforce content models. Could you help me understand this, perhaps with
a simple example?


  *   Chris

From: Lizzi, Vincent vincent.lizzi@xxxxxxxxxxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, February 22, 2023 3:35 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] inserting a child element while honoring the parent
element's content model

>> With respect to *testing* against (not processing in view of) content
models - I hesitate to mention it but there is the approach of writing out the
sequence of element names as a string and then testing that against a regex
mapped out from the content model. One of several problems with this approach
is that the error messages it produces are pretty useless.Limiting the content
model in certain ways can make this easier e.g. forbidding repeated sequence
groups (even worse than 'or' groups).

This might be straying from the original topic, but I can say that Ibve used
the approach that Wendell mentioned and been happy with the results. The error
messages can be better than the typical error messages that one sees from
validating against a DTD or XSD. I used a subset of RelaxNG to describe the
content models which was transformed by XSLT into regular expressions and
error messages that were then used in Schematron. If anyone is interested in
more detail about this implementation let me know.

Cheers,
Vincent

_____________________________________________
Vincent M. Lizzi
Head of Information Standards | Taylor & Francis Group
vincent.lizzi@xxxxxxxxxxxxxxxxxxxx<mailto:vincent.lizzi@xxxxxxxxxxxxxxxxxxxx>

From: Wendell Piez wapiez@xxxxxxxxxxxxxxx<mailto:wapiez@xxxxxxxxxxxxxxx>
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list-service@xxxxxxxxxxxx
rytech.com>>
Sent: Tuesday, February 21, 2023 6:10 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [xsl] inserting a child element while honoring the parent
element's content model

Hey Chris (writing from a different address here),

Exactly - I think we already touched on this thread how the union operator
(a|b|c) has the effect of sorting in document order?

In passing I am noting the difference between

(a|b|c)[1]/(.|preceding-sibling::node())

and without that [1] positional predicate. Going to be quite a bit different.

With respect to *testing* against (not processing in view of) content models -
I hesitate to mention it but there is the approach of writing out the sequence
of element names as a string and then testing that against a regex mapped out
from the content model. One of several problems with this approach is that the
error messages it produces are pretty useless.Limiting the content model in
certain ways can make this easier e.g. forbidding repeated sequence groups
(even worse than 'or' groups).

Cheers, Wendell


Information Classification: General
XSL-List info and
archive<https://urldefense.com/v3/__http:/www.mulberrytech.com/xsl/xsl-list__
;!!A4F2R9G_pg!bwzAi2pgY0I-T8WXu6HAxqXYcNCqSnaHzkvfeRCV8ZqcEaHUPco4K5UhUeuXG4j
WwoE5z10IvW-SHpyB0CIG3vbzAzYvBfAuylPb69qwdF3KYYLOiciQ$>
EasyUnsubscribe<https://urldefense.com/v3/__http:/lists.mulberrytech.com/unsu
b/xsl-list/3380743__;!!A4F2R9G_pg!bwzAi2pgY0I-T8WXu6HAxqXYcNCqSnaHzkvfeRCV8Zq
cEaHUPco4K5UhUeuXG4jWwoE5z10IvW-SHpyB0CIG3vbzAzYvBfAuylPb69qwdF3KYR5n_NES$>
(by email<>)

Current Thread