|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Serializing elements in CDATA, based on an attribu
The only way of getting CDATA sections output by the serializer using standard XSLT capabilities, or using standard Saxon capabilities, is the cdata-section-elements property, and that is driven entirely by element name. For finer-grained control you'll have to do something else. One approach would be output the relevant elements with a different name, e.g. METADATA, and specify cdata-section-elements="METADATA". You can then replace < METADATA and </METADATA by <metadata and </metadata by post-processing the serialized output at the text level. If you're feeling more adventurous it's not difficult to inject a custom processing step into the Saxon serialization pipeline by nominating your own subclass of Saxon's SerializerFactory. Michael Kay Saxonica > On 12 Apr 2017, at 14:23, cmarchand@xxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > > Hello, > In a document, I write many tags of metadata. Part of them, based on @code value (debug & info), MUST be serialized with a CDATA content. > > With this input : > <metadata code="dummy">Standard serialization</metadata> > <metadata code="debug">C-Data serialization</metadata> > <metadata code="foe">Standard serialization</metadata> > <metadata code="info">C-Data serialization</metadata> > > I do expect this : > <metadata code="dummy">Standard serialization</metadata> > <metadata code="debug"><![CDATA[C-Data serialization]]></metadata> > <metadata code="foe">Standard serialization</metadata> > <metadata code="info"><![CDATA[C-Data serialization]]></metadata> > > What must I define as serialization parameters to get this ? I use Saxon 9.7EE, so I can use Saxon extensions. > > Thanks in advance, > Christophe
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








