Accessing node information

Access node information is essential to working with XSLT in Umbraco.

Eventually you may want to acces the following types of nodes:

  • Content nodes
  • Media nodes
  • Member nodes

Accessing attributes and elements of these nodes are essentially done in the same way once you've got the node.

Node attributes are available using the '@' character, e.g. this code will display the nodeName attribute of the current node. 

<xsl:value-of select="@nodeName"/>

All available attributes for the different node types, as well as some example values, are shown in the tables in the last section of this page.

 

Content nodes

Content nodes contain a set of standard attributes as well as your custom fields defined in the document type of the node. Further more content nodes contain child node information (if any children of the nodes exist).

Document type properties are data elements of the content node with the alias attribute set to the property name. These properties can be accessed using syntax like node/data [@alias = 'MyProperty''. E.g. getting the PackageMedia document type property of the $currentPage content node is done like this:

<xsl:variable name="MediaNode" select="$currentPage/data [@alias = 'PackageMedia']"/>

 

Media nodes

Media nodes contain a set of standard attributes as well as your custom fields defined in the media type of the node.

Media type properties are data elements of the media node with the alias attribute set to the property name. These properties can be accessed using syntax like node/data [@alias = 'MyProperty''. E.g. getting the 'umbracoFile' property of the media node with id $MediaNodeId is done like this: 

<xsl:value-of select="umbraco.library:GetMedia($MediaNodeId, 'false')/data [@alias = 'umbracoFile']"/>

 

Node attributes and example data

An automatically extracted version of the available v4 attributes is dynamically listed here:

Content node attributes:
id1087
version68bb8859-ae13-4ce0-83ea-a1d8eebba38c
parentID1083
level4
writerID0
creatorID0
nodeType1078
template1073
sortOrder2
createDate2009-02-27T08:06:30
updateDate2009-09-08T10:52:39
nodeNameAccessing node information
urlNameaccessing-node-information
writerNameAdministrator
creatorNameAdministrator
nodeTypeAliasUmbracoSnippet
path-1,1081,1082,1083,1087
Content node data element (Node/data) attributes:
aliasUmbracoVersions
Member node attributes:
id1114
versionfbe93996-12cf-4273-9677-816483df37c0
parentID-1
level1
writerID0
nodeType1113
template0
sortOrder2
createDate2009-03-02T12:48:59
updateDate2009-03-02T12:48:59
nodeNamedummy
urlNamedummy
writerNameAdministrator
nodeTypeAliasNormal
path-1,1114
loginNamedummy
emaildummy@blackpoint.dk
Media node attributes:
id1092
version60968aad-c6d2-4e54-81b5-56a174d91ee2
parentID1091
level2
writerID0
nodeType1077
template0
sortOrder1
createDate2009-02-27T08:13:28
updateDate2009-02-27T08:13:28
nodeNameBP.Umb.Dashboard, v3
urlNamebp.umb.dashboard,v3
writerNameAdministrator
nodeTypeAliasPackage
path-1,1091,1092