Question 1
<a>
<b>bar</b>
<b>bar</b>
<b>foo</b>
<b>bar</b>
</a>
With reference to the above XML. Taking a/b[4] as the context node,
desbribe an XPath that returns a node-set containing the first b element
in reverse document order that contains the same text node as the current context.
Question 2
<?xml version="1.0"?>
<
test:root xmlns:test="http://elsevier.com/test">
<test:foo>Some text</test:foo>
</test:root>
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:bar="http://elsevier.com/test"
xmlns:test="http://elsevier.com/bar">
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="test:root">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="bar:root">
<bar>
<xsl:apply-templates/>
</bar>
</xsl:template>
<xsl:template match="test:foo">
<xsl:text>Hello</xsl:text>
</xsl:template>
<xsl:template match="bar:foo">
<xsl:text>Goodbye</xsl:text>
</xsl:template>
</xsl:stylesheet>
What is the output of running the above XSLT against the XML and why?
Question 3
If the "xsl
utput" tag is omitted, under what conditions will the serialization process produce HTML rather than XML output?
Choice 1
If the "encoding" attribute is set to "iso-8859-1"
Choice 2
If the first element child of the root node of the result tree is the "<html>" tag
Choice 3
If the output filename extension is ".xml"
Choice 4
If the XSLT processor property "htmlOutputFormat" is set to true
Choice 5
If the "xml" processing instruction version is set to "html" in any combination of upper and lower case
Question 4
Explain both Axes and predicates in Xpath