xsl-list
[Top] [All Lists]

Re: [xsl] passing xml strings to xslt using saxon in java

2007-09-16 08:43:58
The direct answer to your question is: just pass in the string that contains the contents of the xml.

But I assume that after that, you want to create XML from this string and you want to process it (otherwise, why would you ask how to pass in a string? I am sure you know how to do that). Simply use the saxon:parse and/or saxon:serialize extension functions. You can find the details on how to use them on the Saxon website (the first parses an xml string and constructs a node set, the second does the opposite and returns a string equal to what would be produced through normal output processing)

Cheers,
-- Abel Braaksma

PS: note that there is no recovery when the string that is passed in is not well-formed xml!


John Smith wrote:
Hello,


I have a xslt which needs to use 2 xml files, the first one is not
actually a file but an xml formatted string and the second one is an
xml file.

So I want:

xmlString + rules.xml + XSL.xslt = Result.xml

I have tested the scenario with the xsl file referencing the xml files as:

<xsl:variable name="myrules" select="document('myrules.xml')"/>
<xsl:variable name="xmlstring" select="document('myXmlString.xml')"/>

and then created a resulting xml file. However instead of referencing
a file I want to dynamically pass an xmlString to it. I am using
Java+Saxon, is there a way around this? or any alternative methods to
address this problem?


Many thanks,
J

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>