docbook-apps

  • 1.  NVDL, DocBook, and MathML

    Posted 02-09-2016 00:34
    I'm having a problem trying to process DocBook 5 documents using NVDL in
    order to validate DocBook content that has MathML content within
    equation or inlineequation. The DocBook validation side is failing, but
    only under NVDL.

    The DocBook rng schema for inlineequation is as follows:

    <define name="db.inlineequation.content">
    <choice>
    <choice>
    <oneOrMore>
    <ref name="db.inlinemediaobject"/>
    </oneOrMore>
    <oneOrMore>
    <ref name="db.mathphrase"/>
    </oneOrMore>
    </choice>
    <oneOrMore>
    <ref name="db._any.mml"/>
    </oneOrMore>
    </choice>
    </define>

    This schema specifies either a) inlinemediaobject or mathphrase, or b)
    some MathML elements. It *allows* MathML, but it does not validate it
    against the MathML DTD. NVDL is capable of doing that. But ...

    When I set up NVDL using a schema like this:

    <rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
    startMode="docbook">
    <mode name="docbook">
    <namespace ns="http://docbook.org/ns/docbook">
    <validate schema="docbook.rng"/>
    </namespace>
    <namespace ns="http://www.w3.org/1998/Math/MathML">
    <validate schema="../xsd/mathml3/mathml3.xsd"/>
    </namespace>
    </mode>
    </rules>

    This DocBook content validates against docbook.rng:

    <para><inlineequation>
    <math xmlns="http://www.w3.org/1998/Math/MathML">
    ...
    </math>
    </inlineequation></para>

    But when processed with NVDL, it fails with this message:

    Engine name: Jing
    Severity: error
    Description: element "inlineequation" incomplete; expected element
    "alt", "inlinemediaobject" or "mathphrase" or an element from another
    namespace

    I think what is happening is that Jing has sent the <math> element to be
    validated against the MathML schema, and then it sends the remains of
    the inlineequation element to be validated against the DocBook schema.
    But now inlineequation is empty, and fails validation.

    I find if I insert an empty <mathphrase> inside inlineequation, then I
    can work around this error. Does anyone have any other ideas? That is,
    short of customizing the docbook equation elements to allow them to be
    empty.

    --
    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net



  • 2.  Re: [docbook-apps] NVDL, DocBook, and MathML

    Posted 02-09-2016 09:11
    Hi Bob,

    Try adding an attach action on the MathML namespace. This will attach
    the content in MathML to the validation candidate triggered by the
    <validate schema="docbook.rng"/> action. Change the NVDL script as below:

    <rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
    startMode="docbook">
    <mode name="docbook">
    <namespace ns="http://docbook.org/ns/docbook">
    <validate schema="docbook.rng"/>
    </namespace>
    <namespace ns="http://www.w3.org/1998/Math/MathML">
    <attach/>
    <validate schema="../xsd/mathml3/mathml3.xsd"/>
    </namespace>
    </mode>
    </rules>

    Best Regards,
    George
    --
    George Cristian Bina
    <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
    http://www.oxygenxml.com

    On 09/02/16 02:33, Bob Stayton wrote:
    > I'm having a problem trying to process DocBook 5 documents using NVDL in
    > order to validate DocBook content that has MathML content within
    > equation or inlineequation. The DocBook validation side is failing, but
    > only under NVDL.
    >
    > The DocBook rng schema for inlineequation is as follows:
    >
    > <define name="db.inlineequation.content">
    > <choice>
    > <choice>
    > <oneOrMore>
    > <ref name="db.inlinemediaobject"/>
    > </oneOrMore>
    > <oneOrMore>
    > <ref name="db.mathphrase"/>
    > </oneOrMore>
    > </choice>
    > <oneOrMore>
    > <ref name="db._any.mml"/>
    > </oneOrMore>
    > </choice>
    > </define>
    >
    > This schema specifies either a) inlinemediaobject or mathphrase, or b)
    > some MathML elements. It *allows* MathML, but it does not validate it
    > against the MathML DTD. NVDL is capable of doing that. But ...
    >
    > When I set up NVDL using a schema like this:
    >
    > <rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
    > startMode="docbook">
    > <mode name="docbook">
    > <namespace ns="http://docbook.org/ns/docbook">
    > <validate schema="docbook.rng"/>
    > </namespace>
    > <namespace ns="http://www.w3.org/1998/Math/MathML">
    > <validate schema="../xsd/mathml3/mathml3.xsd"/>
    > </namespace>
    > </mode>
    > </rules>
    >
    > This DocBook content validates against docbook.rng:
    >
    > <para><inlineequation>
    > <math xmlns="http://www.w3.org/1998/Math/MathML">
    > ...
    > </math>
    > </inlineequation></para>
    >
    > But when processed with NVDL, it fails with this message:
    >
    > Engine name: Jing
    > Severity: error
    > Description: element "inlineequation" incomplete; expected element
    > "alt", "inlinemediaobject" or "mathphrase" or an element from another
    > namespace
    >
    > I think what is happening is that Jing has sent the <math> element to be
    > validated against the MathML schema, and then it sends the remains of
    > the inlineequation element to be validated against the DocBook schema.
    > But now inlineequation is empty, and fails validation.
    >
    > I find if I insert an empty <mathphrase> inside inlineequation, then I
    > can work around this error. Does anyone have any other ideas? That is,
    > short of customizing the docbook equation elements to allow them to be
    > empty.
    >



  • 3.  Re: [docbook-apps] NVDL, DocBook, and MathML

    Posted 02-09-2016 10:05
    The obvious question George - why doesn't the docbook
    section need the attach?

    Curious!
    regards

    On 9 February 2016 at 09:11, George Bina <george@oxygenxml.com> wrote:
    > Hi Bob,
    >
    > Try adding an attach action on the MathML namespace. This will attach the
    > content in MathML to the validation candidate triggered by the <validate
    > schema="docbook.rng"/> action. Change the NVDL script as below:
    >
    > <rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
    > startMode="docbook">
    > <mode name="docbook">
    > <namespace ns="http://docbook.org/ns/docbook">
    > <validate schema="docbook.rng"/>
    > </namespace>
    > <namespace ns="http://www.w3.org/1998/Math/MathML">
    > <attach/>
    > <validate schema="../xsd/mathml3/mathml3.xsd"/>
    > </namespace>
    > </mode>
    > </rules>
    >
    > Best Regards,
    > George
    > --
    > George Cristian Bina
    > <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
    > http://www.oxygenxml.com
    >
    >
    > On 09/02/16 02:33, Bob Stayton wrote:
    >>
    >> I'm having a problem trying to process DocBook 5 documents using NVDL in
    >> order to validate DocBook content that has MathML content within
    >> equation or inlineequation. The DocBook validation side is failing, but
    >> only under NVDL.
    >>
    >> The DocBook rng schema for inlineequation is as follows:
    >>
    >> <define name="db.inlineequation.content">
    >> <choice>
    >> <choice>
    >> <oneOrMore>
    >> <ref name="db.inlinemediaobject"/>
    >> </oneOrMore>
    >> <oneOrMore>
    >> <ref name="db.mathphrase"/>
    >> </oneOrMore>
    >> </choice>
    >> <oneOrMore>
    >> <ref name="db._any.mml"/>
    >> </oneOrMore>
    >> </choice>
    >> </define>
    >>
    >> This schema specifies either a) inlinemediaobject or mathphrase, or b)
    >> some MathML elements. It *allows* MathML, but it does not validate it
    >> against the MathML DTD. NVDL is capable of doing that. But ...
    >>
    >> When I set up NVDL using a schema like this:
    >>
    >> <rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
    >> startMode="docbook">
    >> <mode name="docbook">
    >> <namespace ns="http://docbook.org/ns/docbook">
    >> <validate schema="docbook.rng"/>
    >> </namespace>
    >> <namespace ns="http://www.w3.org/1998/Math/MathML">
    >> <validate schema="../xsd/mathml3/mathml3.xsd"/>
    >> </namespace>
    >> </mode>
    >> </rules>
    >>
    >> This DocBook content validates against docbook.rng:
    >>
    >> <para><inlineequation>
    >> <math xmlns="http://www.w3.org/1998/Math/MathML">
    >> ...
    >> </math>
    >> </inlineequation></para>
    >>
    >> But when processed with NVDL, it fails with this message:
    >>
    >> Engine name: Jing
    >> Severity: error
    >> Description: element "inlineequation" incomplete; expected element
    >> "alt", "inlinemediaobject" or "mathphrase" or an element from another
    >> namespace
    >>
    >> I think what is happening is that Jing has sent the <math> element to be
    >> validated against the MathML schema, and then it sends the remains of
    >> the inlineequation element to be validated against the DocBook schema.
    >> But now inlineequation is empty, and fails validation.
    >>
    >> I find if I insert an empty <mathphrase> inside inlineequation, then I
    >> can work around this error. Does anyone have any other ideas? That is,
    >> short of customizing the docbook equation elements to allow them to be
    >> empty.
    >>
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >



    --
    Dave Pawson
    XSLT XSL-FO FAQ.
    Docbook FAQ.
    http://www.dpawson.co.uk



  • 4.  Re: [docbook-apps] NVDL, DocBook, and MathML

    Posted 02-09-2016 10:39
    Hi Dave,

    A DocBook document most probably contains only one
    http://docbook.org/ns/docbook section which has some other sections in
    the http://www.w3.org/1998/Math/MathML or other namespaces, like SVG
    maybe. The MathML does not contain DocBook further, if that was the case
    then we should have added maybe additional modes and decide what exactly
    we want to validate.

    To account for other namespaces, like SVG, one may add also a namespace
    rule that will attach possible content in other namespaces to the
    current validation candidates:
    <anyNamespace><attach/></anyNamespace>

    Best Regards,
    George
    --
    George Cristian Bina
    <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
    http://www.oxygenxml.com

    On 09/02/16 12:04, Dave Pawson wrote:
    > The obvious question George - why doesn't the docbook
    > section need the attach?
    >
    > Curious!
    > regards
    >
    > On 9 February 2016 at 09:11, George Bina <george@oxygenxml.com> wrote:
    >> Hi Bob,
    >>
    >> Try adding an attach action on the MathML namespace. This will attach the
    >> content in MathML to the validation candidate triggered by the <validate
    >> schema="docbook.rng"/> action. Change the NVDL script as below:
    >>
    >> <rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
    >> startMode="docbook">
    >> <mode name="docbook">
    >> <namespace ns="http://docbook.org/ns/docbook">
    >> <validate schema="docbook.rng"/>
    >> </namespace>
    >> <namespace ns="http://www.w3.org/1998/Math/MathML">
    >> <attach/>
    >> <validate schema="../xsd/mathml3/mathml3.xsd"/>
    >> </namespace>
    >> </mode>
    >> </rules>
    >>
    >> Best Regards,
    >> George
    >> --
    >> George Cristian Bina
    >> <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
    >> http://www.oxygenxml.com
    >>
    >>
    >> On 09/02/16 02:33, Bob Stayton wrote:
    >>>
    >>> I'm having a problem trying to process DocBook 5 documents using NVDL in
    >>> order to validate DocBook content that has MathML content within
    >>> equation or inlineequation. The DocBook validation side is failing, but
    >>> only under NVDL.
    >>>
    >>> The DocBook rng schema for inlineequation is as follows:
    >>>
    >>> <define name="db.inlineequation.content">
    >>> <choice>
    >>> <choice>
    >>> <oneOrMore>
    >>> <ref name="db.inlinemediaobject"/>
    >>> </oneOrMore>
    >>> <oneOrMore>
    >>> <ref name="db.mathphrase"/>
    >>> </oneOrMore>
    >>> </choice>
    >>> <oneOrMore>
    >>> <ref name="db._any.mml"/>
    >>> </oneOrMore>
    >>> </choice>
    >>> </define>
    >>>
    >>> This schema specifies either a) inlinemediaobject or mathphrase, or b)
    >>> some MathML elements. It *allows* MathML, but it does not validate it
    >>> against the MathML DTD. NVDL is capable of doing that. But ...
    >>>
    >>> When I set up NVDL using a schema like this:
    >>>
    >>> <rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
    >>> startMode="docbook">
    >>> <mode name="docbook">
    >>> <namespace ns="http://docbook.org/ns/docbook">
    >>> <validate schema="docbook.rng"/>
    >>> </namespace>
    >>> <namespace ns="http://www.w3.org/1998/Math/MathML">
    >>> <validate schema="../xsd/mathml3/mathml3.xsd"/>
    >>> </namespace>
    >>> </mode>
    >>> </rules>
    >>>
    >>> This DocBook content validates against docbook.rng:
    >>>
    >>> <para><inlineequation>
    >>> <math xmlns="http://www.w3.org/1998/Math/MathML">
    >>> ...
    >>> </math>
    >>> </inlineequation></para>
    >>>
    >>> But when processed with NVDL, it fails with this message:
    >>>
    >>> Engine name: Jing
    >>> Severity: error
    >>> Description: element "inlineequation" incomplete; expected element
    >>> "alt", "inlinemediaobject" or "mathphrase" or an element from another
    >>> namespace
    >>>
    >>> I think what is happening is that Jing has sent the <math> element to be
    >>> validated against the MathML schema, and then it sends the remains of
    >>> the inlineequation element to be validated against the DocBook schema.
    >>> But now inlineequation is empty, and fails validation.
    >>>
    >>> I find if I insert an empty <mathphrase> inside inlineequation, then I
    >>> can work around this error. Does anyone have any other ideas? That is,
    >>> short of customizing the docbook equation elements to allow them to be
    >>> empty.
    >>>
    >>
    >> ---------------------------------------------------------------------
    >> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    >> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >>
    >
    >
    >



  • 5.  Re: [docbook-apps] NVDL, DocBook, and MathML

    Posted 02-10-2016 21:24
    Great, that worked just fine. Thanks.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    On 2/9/2016 1:11 AM, George Bina wrote:
    > <rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
    > startMode="docbook">
    > <mode name="docbook">
    > <namespace ns="http://docbook.org/ns/docbook">
    > <validate schema="docbook.rng"/>
    > </namespace>
    > <namespace ns="http://www.w3.org/1998/Math/MathML">
    > <attach/>
    > <validate schema="../xsd/mathml3/mathml3.xsd"/>
    > </namespace>
    > </mode>
    > </rules>