Madlik, Monika (LNG-VIE) wrote: > > sometimes the attributes @namest and @nameend of our table-entries > contain invalid values, i.e. the attribute @namest contains the string > "col2_" but this string is not contained at the element colspec. > > Is it possible to assign this particular entry a color via css? Or is > there any other possibility to find such invalid items? > > Example: > <table frame="all" pgwide="0"> > <tgroup cols="2" colsep="0" rowsep="0"> > <colspec align="left" colname="col1" colnum="1" > colwidth="200"/> > <colspec align="left" colname="col2" colnum="2" > colwidth="200"/> > <tbody> > <row> > <entry namest="col1" > nameend="col3"></entry> > <entry/> > </row> > <row> > <entry/> > <entry/> > </row> > </tbody> > </tgroup> > </table> >
Ah! Finally someone who needs to use Schematron (http://www.schematron.com/spec.html). Yes, there is a simple and elegant way to find such problems: use a Schematron schema (in addition to your normal DTD, W3C XML Schema or RELAX NG Schema). [1] Copy attached check_spans.sch in the directory containing your .xxe configuration file. Contents of check_spans.sch --- <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"> <sch:pattern> <sch:rule context="entry/@namest|entry/@nameend"> <sch:assert test="ancestor::tgroup/colsp...@colname = current()]"> Don't find a colspec having '<sch:value-of select="." />' as its colname attribute. </sch:assert> </sch:rule> </sch:pattern> </sch:schema> --- [2] Insert this line in your .xxe configuration file: --- <schematron location="check_spans.sch" namespaceAware="false" /> --- [3] Restart XXE and open a document having the problems you have described. You'll get ``soft validation errors''. See attached screenshot (a DocBook 4 example). Notes: * If your schema uses namespaces, remove namespaceAware="false" from the above line and properly specify the namespaces and their prefixes in check_spans.sch. * check_spans.sch may be easily improved by adding the detection of the case where namest and nameend contains existing column names but where these values have been inverted. This is left as an exercise for you or your local experts. -------------- next part -------------- A non-text attachment was scrubbed... Name: check_spans.sch Type: text/xml Size: 415 bytes Desc: not available Url : http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20071005/a57abd3d/attachment.xml -------------- next part -------------- A non-text attachment was scrubbed... Name: TestCheckSpans.png Type: image/png Size: 42698 bytes Desc: not available Url : http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20071005/a57abd3d/attachment.png

