472,145 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

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 3436
8,658 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 Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.