xsl-list
[Top] [All Lists]

in-document references

2003-01-06 16:06:39
I'm trying to transform a relax NG (RNG) grammar that has in-document references (e.g. ref and define). I could just "flatten" the RNG but I'd rather use the existing document. When I hit a ref in the RNG XML I do this:

  <xsl:template match="ref">
    <li>Ref:
      <b><xsl:value-of select="@name"/></b>
      <ul>
        <xsl:apply-templates
              select="//define[(_at_)name=current()/@name]"
              mode="def"/>
      </ul>
    </li>
  </xsl:template>

which kind of works, except for a big problem. The template rules that are called by this are out of context. In other words, I want to treat them as though they are children of the element "ref" but instead they are treated as top-level elements in the XML file (which is true, of course).

How do I apply the templates and specify that the context should be the current node?

Sorry if this is a FAQ, I couldn't find it.

Simon

---
www.simonwoodside.com


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>