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

Re: How to Parse String with Escaped XML Markup?

Subject: Re: How to Parse String with Escaped XML Markup?
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Jan 2021 15:56:42 -0000
Re:  How to Parse String with Escaped XML Markup?
The reason this works is that saxon:get-pseudo-attribute() expands entity and
character references found in the PI content, so the resulting string contains
angle brackets in place of "& lt ; " and "& gt ;".

Michael Kay
Saxonica

> On 15 Jan 2021, at 15:36, Eliot Kimber ekimber@xxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Yes, I'm using the Saxon extension function to get the value of the @content
pseudo-attribute.
>
> What I didn't realize was that parse-xml and parse-xml-fragment() will
handle the string as it comes, so this works:
>
> <xsl:variable name="rawMarkup"
select="saxon:get-pseudo-attribute('content')/>
> <xsl:variable name="deletedContent" as="element()">
>  <deletedContent xmlns="">
>   <xsl:sequence select="parse-xml-fragment($rawMarkup)/>
>  </deletedContent>
> </xsl:variable>
>
> So it's all good.
>
> Cheers,
>
> E.
>
> --
> Eliot Kimber
> http://contrext.com
>
>
> o;?On 1/15/21, 9:22 AM, "Martin Honnen martin.honnen@xxxxxx"
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>    Am 15.01.2021 um 15:58 schrieb Eliot Kimber ekimber@xxxxxxxxxxxx:
>> I researched this question in this list but I didn't find a recent response
so I'm asking it again.
>>
>> My specific requirement is to take the value of an Oxygen deleted content
processing instruction and parse it back into elements in the context of an
XSLT 3 transform.
>>
>> The PI is:
>>
>> <?oxy_delete author="ekimber" timestamp="20210115T085216-0600"
content="&lt;body&gt;&lt;p&gt;&lt;ul
id=&quot;ul_c5k_mhh_34b&quot;&gt;&lt;li&gt;li one&lt;/li&gt;&lt;li&gt;li
two&lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;&lt;/body&gt;"?>
>>
>> What I'm failing to work out is how to convert the value of the @content
pseudo-attribute back into a proper XML string that I can pass to
parse-xml().
>
>    I think Saxon PE and EE have an extension function to access the pseudo
>    attributes of a processing instruction value.
>
>    So inside of oXygen with Saxon PE or EE this should be easz.

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.