XPathNodeSet: Methods for an XPathNodeSet reference

Description Usage Arguments Author(s) References See Also

Description

An XPathNodeSet object is a container passed from XML/XSL to R and is a reference to a C-level data structure that contains a collection/set of nodes. It is like a list in that it contains zero or more elements, and so we have R-level methods that allow it to be used like a list within R code. These include operations to access an individual element by position, calculate the length and apply a function to each element of the set.

The function XPathNodeSet object is used to create an XPathNodeSet object from within R. This is useful if we want the result of an R function called from XSL to return a collection of nodes for further processing in the XSL transformer or to be included in the output document.

Since an XPathNodeSet is like a list, we provide a a method for [[ to extract individual elements.

Usage

1
2
3
4
5
XPathNodeSet(..., els = list(...), duplicate = FALSE)
## S3 method for class 'XPathNodeSet'
x[[i, j, ...]]
## S3 method for class 'XPathNodeSet'
x[i, j, ..., references = FALSE]

Arguments

...

individual XMLInternalNode elements. This can be obtained from other XSL calls operations or by explictly creating internal nodes using functions in the XML package such as newXMLNode and others.

In the [[ operator, ... are additional indices identifying the elements of interest.

els

the list of XMLInternalNode objects that are to be put into the XPathNodeSet object. This is for programmatic use when we already have a list XMLInternalNode objects, as opposed to the ... mechanism which is for interactive use when we have individual elements.

x

the XPathNodeSet reference object

i, j

the index/indices of the element to be returned.

duplicate

a logical value indicating whether the nodes being inserted into the XPathNodeSet container should be cloned/copied (in entirety, i.e. recursively).

references

a logical value that controls whether we return the values of the XPath elements in the node set or references to the C-level objects. references = TRUE give us the latter and these can be useful if we want to modify the C-level data structures rather than just query their values.

Author(s)

Duncan Temple Lang

References

http://www.omegahat.org/Sxslt, http://www.omegahat.org/SXalan, http://www.w3.org/Style/XSL

See Also

[.XMLAttributes [.XMLChildren node.xsl, node.xml and ok.R in the examples directory.


sckott/sxslt documentation built on May 26, 2017, 3:49 a.m.