You can use that to query the document further. To get the root node of the parsed XML document, for example, use:
<xsl:variable name="catalogElement"
select="document:getDocumentElement($parsedDocument)"/>
You can obtain node lists as well as individual nodes. To modify the first journal node, first retrieve the list of journal nodes from the parsed XML document:
<xsl:variable name="journalNodeList"
select="element:getElementsByTagName(
$catalogElement,'journal')"/>
Then select the first node from the list:
<xsl:variable name="journalNode"
select="nodelist:item($journalNodeList, 0)"/>
Because XSLT can't cast objects (remember?) you have to convert the journal node, which is of type org.w3c.dom.Node, to an org.w3c.dom.Element using the Java NodeToElement class's nodeToElement(Node node) method. You assign the result to an XSLT variable:
<xsl:variable name="journalElement"
select="nodeElement:nodeToElement($journalNode)"/>
Note that the call was slightly different, because nodeToElement() is a static method. The syntax for a static method in an XSLT is...
select="<classprefix>:<classmethod>(<methodparam1>,
<methodparam2>)"
...where <classprefix> is the namespace prefix for the Java class, <classmethod> is the static method you're calling, and <methodparam1>, <methodparam2> (etc.) are the static method parameters.
Modifying Attributes
To modify an element's attributes, you first remove the attribute, and then add a new attribute and value to the element. So, for example, to change the date attribute in the journal element, first remove it:
<xsl:value-of select="element:removeAttribute(
$journalElement, 'date')"/>
Then create a new attribute and add it to the journal element:
<xsl:value-of select="element:setAttribute($journalElement,
'date', 'January-February 2004')"/>
The sample XSLT uses a similar process to modify the article element's section attribute.