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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:25:36+00:00 2026-06-18T03:25:36+00:00

This is my problem: I am trying to use XSLTProcessor to transform xml to

  • 0

This is my problem: I am trying to use XSLTProcessor to transform xml to html. I have already read about its use, but I have the following problem – the transformToXML(xml_file) function requires the xml_file to be an actual xml file. Is it possible for the transformToXML function to use a string instead of a file? I have tried searching this online but all I get is stuff I have already seen with the use of an xml file. Since I need to use this transformation on a big scale (a big number of different transformations for a lot of users) I can’t use a file on the server. Here’s my code so maybe you can get a better picture:

$productxml=  GetShoppingItem($params);

$file = 'ProductQr.xml';    
file_put_contents($file, $productxml);

$xml = new DOMDocument();
$xml->load('ProductQr.xml');

$XSL = new DOMDocument();
$XSL->load('XSLTForProduct.xsl');

$xslt = new XSLTProcessor();
$xslt->importStylesheet($XSL);

$html = $xslt->transformToXML( $xml );
return $html;

As you can see, here I am getting the $productxml string and writing it into ProductQr.xml so I can later use it here: transformToXML($xml). But there will be a lot of transformations and I can’t use one xml file since there are a lot of different products. Ideally I would use:

$html = $xslt->transformToXML($productxml);

without writing into the xml file, but the transformToXML needs a file and not a string. Any thoughts?

  • 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-06-18T03:25:37+00:00Added an answer on June 18, 2026 at 3:25 am

    You can use loadXML instead of load to parse XML from a string.

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

Sidebar

Related Questions

I've got this problem trying to use Html helpers. I've read that dynamical casting
Ok I have this problem I'm trying to use Jquery to load a partial
I am trying to use (and this may be my problem already) e.Graphics.CopyFromScreen() in
I have the following problem trying to use a custom config section in my
so I have run now with this problem when trying to use FragmentStatePagerAdapter with
I am trying to use this python module HTML.py but GAE gives me ImportError:
does anyone have suggestions for this problem? i am trying to use oracle SQL
So I am running into this problem. I am trying to use $.get() to
i'm new here so this is the problem: I'm trying to use chosen plugin
I'm trying for hours now to solve this problem.. So.. I want to 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.