xsl-list
[Top] [All Lists]

Re: [xsl] How Best to Generate Result Documents from Nested Structures?

2014-05-25 12:50:45
I think I misstated or misunderstood the restriction. The restriction I'm
referring to is:

"There are restrictions on the use of the xsl:result-document
<http://www.w3.org/TR/xslt20/#element-result-document> instruction,
designed to ensure that the results are fully interoperable even when
processors optimize the sequence in which instructions are evaluated.
Informally, the restriction is that the xsl:result-document
<http://www.w3.org/TR/xslt20/#element-result-document> instruction can
only be used while writing a final result tree, not while writing to a
temporary tree or a sequence."

From the XSLT 2 spec, 19.1 Creating Final Result Trees

If I understand this statement it means that I can have nested
xsl:result-document instructions if I'm otherwise generating the final
result tree but not if I'm constructing an intermediate tree, meaning
generation the value of a variable.

So given the document:

<a>
  <b>
   <c/>
  </b>
</a>

I should be able to do this:

<xsl:template match="*">
  <xsl:result-document href="{name(.)}.xml">
    <result><xsl:value-of select="name(.)"/></result>
    <xsl:apply-templates/>
  </xsl:result-document>
</xsl:template>

And get three result documents, a.xml, b.xml, and c.xml.

Cheers,

E.

—————

Eliot Kimber, Owner
Contrext, LLC
http://contrext.com




On 5/25/14, 12:34 PM, "Michael Kay mike(_at_)saxonica(_dot_)com"
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:


This
approach avoids the restriction on starting a new <xsl:result-document>
in
the context of an existing <xsl:result-document>.


I'm not sure what restriction you are referring to. It's entirely
permitted to open a new result document while you're already generating a
result document.

Michael Kay
Saxonica


--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

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