[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: inserting a child element while honoring the paren
Chris, The trick is essentially to represent the sequence of elements as a string ...' h1 p p p p h2 p p p p h3 p h1 p p'. Your regex then captures the logic of the content model enforced on this sequence as a pattern over the string. Was it Rick Jelliffe we borrowed this idea from? If not it was someone equally creative, I would say. Again it's not something I recommend but if Vincent is happy with his results that speaks for itself. Regards, Wendell (at that daytime email). From: Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Sent: Wednesday, February 22, 2023 3:38 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: inserting a child element while honoring the parent element's content model 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<mailto:vincent.lizzi@xxxxxxxxxxxxxxxxxxxx> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list-service@xxxxxxxxxxxx rytech.com>> Sent: Wednesday, February 22, 2023 3:35 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Subject: Re: 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 I've 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: 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://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Furl defense.com%2Fv3%2F__http%3A%2Fwww.mulberrytech.com%2Fxsl%2Fxsl-list__%3B!!A4 F2R9G_pg!bwzAi2pgY0I-T8WXu6HAxqXYcNCqSnaHzkvfeRCV8ZqcEaHUPco4K5UhUeuXG4jWwoE5 z10IvW-SHpyB0CIG3vbzAzYvBfAuylPb69qwdF3KYYLOiciQ%24&data=05%7C01%7Cwendell.pi ez%40nist.gov%7C93666f9eb2f64a8877a708db1514bc17%7C2ab5d82fd8fa4797a93e054655 c61dec%7C1%7C0%7C638126951060665795%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwM DAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=yFNmY GEy0QGPpWXzFz2LtVMcFoe56kryjKDp6VXMTXY%3D&reserved=0> EasyUnsubscribe<https://gcc02.safelinks.protection.outlook.com/?url=https%3A% 2F%2Furldefense.com%2Fv3%2F__http%3A%2Flists.mulberrytech.com%2Funsub%2Fxsl-l ist%2F3380743__%3B!!A4F2R9G_pg!bwzAi2pgY0I-T8WXu6HAxqXYcNCqSnaHzkvfeRCV8ZqcEa HUPco4K5UhUeuXG4jWwoE5z10IvW-SHpyB0CIG3vbzAzYvBfAuylPb69qwdF3KYR5n_NES%24&dat a=05%7C01%7Cwendell.piez%40nist.gov%7C93666f9eb2f64a8877a708db1514bc17%7C2ab5 d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638126951060665795%7CUnknown%7CTWFpbGZ sb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C300 0%7C%7C%7C&sdata=rU974qUJfrGL4QeEdUPy6rI3ei%2B5SD0jr9GEQGH4ZDI%3D&reserved=0> (by email) XSL-List info and archive<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww. mulberrytech.com%2Fxsl%2Fxsl-list&data=05%7C01%7Cwendell.piez%40nist.gov%7C93 666f9eb2f64a8877a708db1514bc17%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C6 38126951060665795%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzI iLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=26UtocWziB2hSlnErQTY%2F 6mm5Wd%2Bvzp0OiQGvV0Eaoc%3D&reserved=0> EasyUnsubscribe<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2 F%2Flists.mulberrytech.com%2Funsub%2Fxsl-list%2F3302254&data=05%7C01%7Cwendel l.piez%40nist.gov%7C93666f9eb2f64a8877a708db1514bc17%7C2ab5d82fd8fa4797a93e05 4655c61dec%7C1%7C0%7C638126951060665795%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wL jAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=0 oe0TmFcZUTb0fmrlUrJOO8QOi9zILyCslp3N1rqvi0%3D&reserved=0> (by email<>)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|