469,327 Members | 1,242 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,327 developers. It's quick & easy.

Get page name via XSLT?

I there a way to get the current page's name using XSLT and store it in a variable?

Something like:

<xsl:variable name="myVariable" select="PageName"/>
Dec 31 '08 #1
4 3380
8,651 Expert Mod 8TB
generally speaking, XSL can get everything contained in the source XML. If page name means the file name, then no (this requires file system functions).

Jan 1 '09 #2
2,057 Expert 2GB
XSLT was not designed to do this (eg, be Environment aware). Some possibilities, depending on how you are running this transformation:

1. Have the containing code (which calls the XSLT) pass in a parameter of the filename to the XSLT processor.
2. Have the XSLT reference a static lookup file. Before running the transformation, update the file with the lookup file filename.
Jan 5 '09 #3
In my case, I assume the 'containing code (which calls the XSLT)' would be the ASP code I use to call both the XML and XSLT (see code below). Is that correct? If so, any idea how to do that?

Expand|Select|Wrap|Line Numbers
  1. <asp:Xml runat="server" documentSource="xml/sample.xml" transformSource="xml/sample.xsl" id="sample"  />
Jan 5 '09 #4
2,057 Expert 2GB
Use the Xml::TransformArgumentList property
Xml.TransformArgumentList Property (System.Web.UI.WebControls)

Adding parameters to the Argument list:
XSLT Parameters
Jan 5 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Miles Cousens II | last post: by
reply views Thread by vinki | last post: by
1 post views Thread by vinki | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Purva khokhar | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.