Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6666391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:49:25+00:00 2026-05-26T02:49:25+00:00

I am using XSLT 1.0 and have below sample code: In my XSLT, I

  • 0

I am using XSLT 1.0 and have below sample code:

In my XSLT, I have got a param which has my XML path

<xsl:param name="sitespath"/>

I know I can load it as document and then further get the values accordingly, like below

  <xsl:variable name="siteInfoPath" select="document($sitespath)/sitedata/region/site/language"/>

The above siteInfoPath XSLT varaible is loading the document with /sitedata/region/site/language data, however now I want to take PublishDate, below is the XML sample format

<?xml version="1.0"?>
<sitedata>
<resources>
<WorldwideSites>Worldwide sites</WorldwideSites>
<PublishedDate>10/3/2011 9:12:35 AM</PublishedDate>
</resources>
<region code="global" title="Global">
<site defaultLanguage="en" id="tcm:0-233-1" url="/english" countryCode="" title="" order="1">
<language code="en" pubId="tcm:0-233-1" pubPath="\english" Culture="en-GB" ShortDate="dd MMM yy" ShortDateShortDay="ddd dd MMM yy" ShortDateTime="dd MMM yy, HH:mm" LongDate="d MMMM, yyyy" LongDateTime="d MMMM, yyyy, HH:mm" LongDateExtendedShortDay="ddd dd MMM, yyyy" LongDateExtended="dddd, d MMMM, yyyy" LongDateExtendedTime="dddd, d MMMM, yyyy, HH:mm" MonthYear="MMMM, yyyy" OmniturePrefix="ek global:en:" OmnitureReportSuite="emirnewglobalenglish,emirnewibems" OmnitureDevReportSuite="emirglobalendev" sifr="Y" localTitle="" url="/english" mobileRedirect="true" flightStatusAlert="true" GoLiveDate="20071110" targetHost="http://fly1.com" hpSearchF="Yes" hpHotelsCars="Yes" hpMYB="Yes" hpOLCI="Yes" hpFStatus="Yes" hpServicesF="Yes">English</language>
</site>

Do I need to use another variable and need to load document like this

<xsl:variable name="siteInfoDate" select="document($sitespath)/sitedata/resources/PublishedDate"/>

I don’t want to load same xml again…please suggest!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:49:26+00:00Added an answer on May 26, 2026 at 2:49 am

    Dynamic Xpath evaluation in general requires using an extension function –both in XSLT 1.0 and in XSLT 2.0. This is not a good idea, because you may or maynot find such an extension and may end up needing to write your own. Also, the code’s portability is ruined.

    Do I need to use another variable and need to load document like this

    <xsl:variable name="siteInfoDate" select="document($sitespath)/sitedata/resources/PublishedDate"/>
    

    I don’t want to load same xml again…please suggest!!

    This is actually the best way to solve the problem.

    It is a widespread misconception that issuing more than one calls to the document() function with the same URL loads and parses the same document more than once.

    The W3C XSLT specification defines that the URL typically is loaded and parsed only once — the function is stable, regardless how many times the document() function is called.

    Therefore, there isn’t any loss of efficiency.

    To eliminate your fears, do (this will help you sleep well, but isn’t at all necessary):

    <xsl:variable name="vDoc" select="document($sitespath)"/>
    
    <xsl:variable name="siteInfoDate" 
                  select="$vDoc/sitedata/resources/PublishedDate"/>
    
    <xsl:variable name="siteInfoPath" 
       select="$vDoc/sitedata/region/site/language"/>  
    

    Here you obtain the document using only one, single call to the document() function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using XSLT and XML. I have got below XML. <documentCountryInformation> <countryCode>US</countryCode> <countryName>United
I am trying to sort an xml using xsl. Got some sample from xml.com.
I am using XSLT and XML, I have below XML format with me. <?xml
I am using C# 2.0 and I have got below code: XmlDocument doc =
I have to merge two xml documents using xslt 1.0. Each xml document has
I have an xml data which has shown below. <Roll NO=4620 CLASSNO=0 ID=0 DID=0
I am have trouble converting my xml using XSLT back to xml in the
Is it possible to merge elements using XSLT. If I have the following XML
Using XSLT 1.0 - I have the following xml and I an trying to
My source XML provides data column-by-column; the cells have varying heights. Using XSLT 1.0,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.