Skip to content

Trang loses a namespace prefix? #287

@ndw

Description

@ndw

Converting this grammar:

default namespace = "http://example.com/ns"
namespace g = "http://example.com/ns"
namespace one = "http://example.com/ns/one"
namespace two = "http://example.com/ns/two"

start = g.start

oneAttributes = attribute one:* { text }*

twoAttributes = attribute two:* { text }*

commonAttributes = oneAttributes & twoAttributes

g.start =
    element g:start {
        commonAttributes,
        empty
    }

to xml with trang produces:

<grammar ns="http://example.com/ns/two"
         xmlns:g="http://example.com/ns"
         xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <ref name="g.start"/>
  </start>
  <define name="oneAttributes">
    <zeroOrMore>
      <attribute>
        <nsName ns="http://example.com/ns/one"/>
      </attribute>
    </zeroOrMore>
  </define>
  <define name="twoAttributes">
    <zeroOrMore>
      <attribute>
        <nsName/>
      </attribute>
    </zeroOrMore>
  </define>
  <define name="commonAttributes">
    <interleave>
      <ref name="oneAttributes"/>
      <ref name="twoAttributes"/>
    </interleave>
  </define>
  <define name="g.start">
    <element name="g:start">
      <ref name="commonAttributes"/>
      <empty/>
    </element>
  </define>
</grammar>

To my eye, the ns attribute is missing from the nsName in the twoAttributes pattern.

Is that a bug in trang, or a misunderstanding on my part?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions