xsl-list
[Top] [All Lists]

Re: [xsl] attribute value templates in elements fetched from a map?

2020-09-02 17:27:18
On 02.09.2020 22:08, Graydon graydon(_at_)marost(_dot_)ca wrote:

The prototype has a whole bunch of individual templates which are mostly
the same except in match expression and in one of the values created;
the XML structure is mostly identical.  Many other things about the
process are being driven out of a map already, and I find myself
wondering if there's a way to (in effect) have a dynamic call-template
instruction; I want to keep the context, and maybe evaluate some
attribute value templates in the xml nodes provided, but which exact
nodes (and which exact attribute value templates) vary.

The transform function is computationally expensive and I'd have to pass
in arbitrary context (for things like determining heading depth); that
doesn't seem appealing.  xsl:evaluate can evaluate the XPath in the
current context but then there's no obvious way to get that value into
the markup:

<xsl:map-entry key="'list'">
     <style>
       <style-name val="List" />
       <paragraphNumber>
             <level depth="{$calculated[1]}"/>
       </paragraphNumber>
     </style>
</xsl:map-entry>

returns an error because $calculated is undefined.

I don't understand where you use xsl:evaluate and where you bind the
value to $calculated.

If you have

  <xsl:variable name="calculated" as="item()*">
    <xsl:evaluate .../>
  </xsl:variable>

before that xsl:map the variable should be defined.



--~----------------------------------------------------------------
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>