Re: [xslt] Parse stylesheet from a string (in memory) instead of from a file?

Hi Leif,

I had to solve this once before. My solution had then several step:
- use xmlReadMemory from libxml2 to read the XML from memory. this creates an xmlDocPtr
- use xmlDocGetRootElement to get the root xmlNodePtr
- use xsltParseStylesheetDoc from libxslt to create the xsltStylesheetPtr
- use xsltApplyStylesheet with the the stylesheet and an xmlDocPtr to convert.

This worked quite well in my case.

Best regards,

On Wed, Nov 17, 2021 at 6:44 PM Bloomquist, Leif via xslt <xslt gnome org> wrote:

Hi all,


I’m porting an application that uses libxml/libxslt to an embedded platform that has no filesystem.


Accordingly, I’m trying to find (and hopefully not have to write) an equivalent to xsltParseStylesheetFile() that accepts a string representation of the stylesheet, instead of a filename/URI pointing to it.  Coming up blank.


For the schema file, I was able to simply replace xmlSchemaNewParserCtxt() with xmlSchemaNewMemParserCtxt() – is there an equivalent in libxslt that I’m overlooking?


I’m also willing to accept that there is a better approach that I haven’t considered : - )


Any help appreciated.




The information transmitted by and/or attached to this email is intended only for the person or entity to which it is addressed. This email and any attachments may contain proprietary, confidential and/or privileged material. If you are not the intended recipient of this message, be aware that any use, review, retransmission, distribution, reproduction or any action taken in reliance upon this message is strictly prohibited. If you received this in error, please contact the sender and delete the material from all computers.

Les renseignements transmis par ou joints au présent courrier électronique sont destinés uniquement à la personne ou à l'entité à laquelle ils sont adressés. Le présent courrier électronique et toute pièce jointe peuvent contenir des renseignements exclusifs, confidentiels ou privilégiés. Si vous n'êtes pas le destinataire de ce message, veuillez noter que toute utilisation, révision, retransmission, distribution, reproduction ou toute action entreprise sur la base de ce message est strictement interdite. Si vous avez reçu ce message par erreur, veuillez communiquer avec l'expéditeur et supprimer le contenu de tous les ordinateurs.

xslt mailing list, project page
xslt gnome org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]