Re: [xsl] Getting the name the input data document

Subject: Re: [xsl] Getting the name the input data document
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 20 Aug 2009 21:22:14 -0400
At 2009-08-20 18:18 -0700, Mark Wilson wrote:
I've poked around, but suspect I am searching for the wrong terms in the index to Michael's XML/XPath book. I found one reference on the web that said what I want to do could not be done with XSLT 1.0.

You can do it for the stylesheet in XSLT 1.0 but not for the data file.

However, I am using XSLT 2.0.

Not a problem.

I need to know the file name of the file my XSLT style sheet is acting upon so that I can write it out as part of the tile of an XSL-FO output PDF document. Does XSLT 2.0 have a way of getting the file name?

The document-uri() function is what you need.

I hope the example below helps.

. . . . . . . . Ken

t:\ftemp>xslt2 mark.xml mark.xsl

Filename: file:/t:/ftemp/mark.xml
t:\ftemp>type mark.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="";

<xsl:output method="text"/>

<xsl:template match="/">
Filename: <xsl:value-of select="document-uri(/)"/>


Interested in these classes?
Crane Softwrights Ltd.
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:
Video overview:
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07
Legal business disclaimers:

Current Thread