xsl-list
[Top] [All Lists]

RE: Reusing XPath statements (defining once and only once)

2003-04-18 04:01:51
The stylesheet works, but the XPath expressions bother me. I 
would like 
to declare this XPath once:

@* | * | comment() | processing-instruction() | text()

and refer to it elsewhere. I tried to make it a variable, but it 
doesn't seem to work.

Nope, it's not going to. Variables are bound to values, not 
to expressions 
that can be evaluated.

In XSLT 2.0, of course, you can define this as a function:

<xsl:function name="my:sprogs">
  <xsl:param name="here" as="node"/>
  <xsl:result select="$here/node() | $here/@*"/>
</xsl:function>

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 


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



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