27.09.11

XSLT-elements of the current document

XSLT Icon

If you have (like me) been wondering why accessing data elements of the current document would always return empty values, you should take a look at the following XSLT advice:

When using the toolbar to insert a data element (here: 'article photo'), following code is added:

<xsl:value-of select="data [@alias = 'articlePhoto']"/>

This code is correct if it is part of an enumeration loop. Without this reference to the current item, the code snippet has to read:

<xsl:value-of select="$currentPage/data [@alias = 'articlePhoto']"/>

Furthermore, the variable $currentPage in the XSLT-script needs to be initialized correctly:

<xsl:param name="currentPage"/>

HTH