Just use your relative path to select the nodes, and then use the path() function to get the absolute path:

<xsl;for-each select="RELATIVE_PATH">
  <xsl:value-of select="path(.)"/>
</xsl:for-each>

You still haven't explained what you mean by an absolute path. As I explained, there are several different things you might mean.

Michael Kay
Saxonica

On 17 Apr 2013, at 14:12, Kunal Chauhan wrote:

Hi,

I checked above function. It will give me a path of current node.
but here I want something like, when I pass relative path to it.  it will give me absolute path of that node.

I also check in Saxon help
there is a method call selectNode in an abstract class Pattern. when I provide Doc and XPath, it will return  that element from the doc.
but this is an abstract class so I need to implement this method. is there any method available in Saxon like above ??

Thanks
Kunal


On Mon, Apr 15, 2013 at 8:15 PM, Michael Kay <mike@saxonica.com> wrote:

Look at the extension function saxon:path() or the XPath 3.0 function fn:path().

They may or may not meet your needs. It depends whether you want the names to be namespace-qualified, and it depends whether you want subscripts indicating the position of each node among its siblings. If you just want the element names and don't care about namespaces, then string-join(ancestor-or-self::*/name(), '/') does the job perfectly well.

Michael Kay
Saxonica

On 15 Apr 2013, at 12:54, Kunal Chauhan wrote:

Hello,

Is there any method available through which I can convert relative XPath to absolute XPath.

for eg, below is my xml

<mainNode>
      <element1>
               <firstName>Kunal</firstName>
               <lastName>Chauhan</lastName>
      </element1>
</mainNode>


Now, if I pass below XPath to any method.
   //firstName 
    OR
   /mainNode/./firstName

I will get below my expected XPath
my expected XPath is :   /mainNode/element1/firstName

Thanks and Regards,

--
Kunal Chauhan
[+918655517141]
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help



--
Kunal Chauhan
mail4ck@gmail.com
[+918655517141]
[+919904983614]
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help