building a mental model for the "current node" behavior

"Chris Papademetrious [email protected]" <[email protected]>
Newsgroups gmane.text.xml.xsl.general.mulberrytech
Message-ID <[email protected]>
I'm trying to better my understanding of "current node" behavior in XSLT, and I have a couple questions.


1. Which stylesheet elements select the current node "."?

"How XPath Context Is Initialized" at

https://www.lenzconsulting.com/how-xslt-works/

states that aside from template matches, only <for-each> (and <foreach-in-group>) change the current node ".". However, other XSLT stylesheet elements provide a @select attribute:

<xsl:copy select="...">
  ...
</xsl:copy>
<xsl:message select="...">
  ...
</xsl:message>

As a novice, I get confused remembering when the current node does/doesn't change. There's also this, which I'm trying to grasp:

https://www.w3.org/TR/xslt-30/#func-current

What's a good mental model for remembering this?


2. Inside an <xsl:template> block, is there a function that returns the current *template-matched* node?

For example, let's say I'm looping through the contents of a variable and I want to <xsl:copy> my current template node in each iteration. Is there a function to reference it without having to stuff it in a variable at the beginning of the template? I don't see such a function in the spec, but it could be eluding me.


Thanks!

-----
Chris Papademetrious
Tech Writer, Implementation Group
(610) 628-9718 home office
(570) 460-6078 cell
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/3329386
or by email: [email protected]
--~--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.