[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Passing an XML fragment as a parameter

Subject: Re: Passing an XML fragment as a parameter
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 28 Mar 2019 18:42:59 -0000
Re:  Passing an XML fragment as a parameter
There's no built-in capability to parse XML from XSLT code in XSLT 2.0. Your
choices are:

(a) write your own extension function to do it, or

(b) parse the XML in the calling application, and pass the parsed XML tree as
a parameter, rather than the unparsed lexical XML.

Either way, the details will depend on the interfaces provided by your XSLT
processor.

Michael Kay
Saxonica

> On 28 Mar 2019, at 18:28, Charles O'Connor coconnor@xxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Unfortunately, <xsl:text> cannot have child elements, and I believe that the
interpretation as entities is happening upstream.
>
> -----Original Message-----
> From: Christophe Marchand cmarchand@xxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
> Sent: Thursday, March 28, 2019 1:56 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  Passing an XML fragment as a parameter
>
> Someting like
>
> <xsl:text disable-output-escaping="yes"><xsl:copy-of
> select="$NewAbstract"/></text> ?
>
> Christophe
>
> Le 28/03/2019 C  18:38, Charles O'Connor coconnor@xxxxxxxxxxxx a C)crit :
>> Hi,
>>
>> I need to create a transform for our engineers to pass an XML fragment
stored in a SQL database into a document as a parameter. Testing this in
Oxygen using XSLT 3.0 and Saxon 9.7.0.15 is super easy. I can just declare the
parameter and then use the function fn:parse-xml-fragment:
>>
>>     <xsl:template match="article-meta/abstract">
>>         <xsl:copy-of select="fn:parse-xml-fragment($NewAbstract)"/>
>>     </xsl:template>
>>
>> Unfortunately, the transform has to work in an environment limited to XSLT
2.0 (XMLPrime). Without the function, the angle brackets are interpreted as
greater and less than entities. (Various semi-embarrassing experiments I've
done to try to force the issue get the processor to complain that value of the
parameter is xs:untypedAtomic.)
>>
>> I'm guessing this could be solved by saving the XML fragment as a document,
but is there a way to do it from memory?
>>
>> Thanks,
>> Charles
>>
>>
>> Charles O'Connor l Business Analyst
>> Aries Systems Corporation l www.ariessys.com
>> 50 High Street, Suite 21 l North Andover, MA l 01845 l USA
>> Direct: 802-585-5655

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.