• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

please solve my xslt questions as i am preparing for interview..very urgent...help me

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This sounds more like homework than interview questions, but in either case, first tell us what you think. You won't learn much if we give you all the answers, and we aren't the ones sitting the interview
 
moose poop looks like football shaped elk poop. About the size of this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic