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 3231170
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:00:49+00:00 2026-05-17T17:00:49+00:00

In my XSLT file. I use the document() function <xsl:variable name=Publicity select=document(‘./publicity.xml’) /> and

  • 0

In my XSLT file. I use the document() function

<xsl:variable name="Publicity" select="document('./publicity.xml')" />

and that works but if I try to link a PHP script that generate the XML dynamically,

<xsl:variable name="Publicity" select="document('./publicity.php')" />

I get a

Warning: XSLTProcessor::transformToXml() [xsltprocessor.transformtoxml]: file:///C:/wamp/www/XSLT/test.php:3: parser error : Start tag expected, '<' not found in ... on line ...

Which consist of the < from <?php

It looks like the XSLTProcessor isn’t requesting the file like via a HTTP request so it’s not executed by Apache / PHP.

I know I could simply include that XML structure to my main XML but I’m trying to avoid this… until someone tell me there is no other way.

Thank you!

  • 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-17T17:00:49+00:00Added an answer on May 17, 2026 at 5:00 pm

    Right the document() function just reads a file off the disk, it does not make an HTTP request. So the PHP doesn’t execute.

    You’ll have to use an URL instead of just the filename as the argument to your document() function.

    <xsl:variable name="Publicity" 
         select="document('http://example.com/publicity.php')" />
    

    I believe that using an URL in this way is a common feature in most XSLT processors, but I have not tested it with PHP, so your mileage may vary.

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

Sidebar

Related Questions

I have the following code that applies a XSLT style Test.Xml.xslTransform = function(xml, xsl)
I am writing an XSLT file to translate an XML document into an XHTML
I've the following xslt file: <?xml version=1.0 encoding=UTF-8?> <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <!-- USDomesticCountryList -
I'm using XSLT 1.0 an want to transform an XML file. It works fine
I have an XSLT stylesheet that transforms an XML file to JSON format and
For the following XML <Properties ComponentID=1272040480745 Admin=true> <Datum ID=P01 Type=File Name=CSS To Use>style.css</Datum> <Data>
Within an XSL stylesheet, I'm trying to use the document() function with a relative
I am working with xslt 1.0 and trying to use the XSLT document function
Can I use multiple Xslt to create a single output xml file. In my
I'm building several XSLT stylesheets (e.g. hotels.xsl, flights.xsl, tickets.xsl, etc..) that will all use

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.