Re: [xsl] The evaluate function

Subject: Re: [xsl] The evaluate function
From: Joerg Pietschmann <joerg.pietschmann@xxxxxx>
Date: Mon, 14 Jan 2002 12:28:26 +0100
David Carlisle <davidc@xxxxxxxxx> wrote:
> If your input document is (say) an XML schema, or an XSL stylesheet it
> will contain XPaths in attribute content. How can you "XML-ify" those
> without invalidating the documents?

Can you present use cases where XML schemas of stylesheets will
have to be processend and 
- XSLT has a significant advantage for this purpose over other tools
- the mentioned XPath expressions have to be evaluated
- the stylesheet-generating-stylesheet approach is not feasible.

I didn't want to XML-ify every XPath everywhere. However, the more
often presented "use cases" for evaluate() are

1) Sort of ... well... clueless newbie problems, like the recently
 presented
   <xsl:for-each select="/some/stuff">
     <xsl:value-of select="concat('/some/other-stuff[',position(),']')"/>
   </xsl:for-each>
 (no offense to beginners meant)
2) The somewhat less obviously solvable "user enters fieldname to be
 selected/sorted" problem:
  <xsl:param name="fieldname"/>
  <xsl:for-each select="table/$fieldname">
 Admittedly, if namespaces are used, this solution is not as robust as
 using evaluate().
3) The problems where people put longer XPaths into XML files and
 want them to use for retrieving certain nodes in some other documents,
 basically references.

As for 3), the path expressions are usually simple, using at most
positional predicates, like "/some/path/to[1]/stuff[2]". This subset
of XPath could be XMLified without all that much inconvenience.
Apart from this, quite often i wondered why they didn't use ids
for cross references (can a XForms guru explain it to me why
there are XPath expressions used in XForms?)

> ... XSLT-evaluate ...

Funny but...

Regards
J.Pietschmann

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


Current Thread