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

Re: Output < and > in the attribute from the style she

Subject: Re: Output < and > in the attribute from the style sheet
From: Mansour Al Akeel <mansour.alakeel@xxxxxxxxx>
Date: Sat, 21 Apr 2012 19:00:20 -0400
Re:  Output < and > in the attribute from the style she
Martin,
thank you. I understand that the '>' doesn't have to be escaped in
this case, and the final results is valid XML. However,
I am wondering about a clean way to prevent the serializer from
escaping it in the attributes.
Currently, the combination of <xsl:text> and CDATA, is working fine,
but it's ugly as I loose syntax highlight, and indentation.
That is why I am looking for a better a way.

Thank you.

On Sat, Apr 21, 2012 at 7:15 AM, Martin Honnen <Martin.Honnen@xxxxxx> wrote:
> Mansour Al Akeel wrote:
>>
>> In on of the sheets I am working on there is the sign ">" in on of the
>> attributes. I am trying to get this in the resulting XML.
>> So I have this in my template:
>>
>>        <dependencies>
>>                <xsl:text disable-output-escaping="yes">
>>                <![CDATA[
>>                        <dependency org="org.slf4j" name="slf4j-api"
>> rev="1.6.4"
>> conf="provided->*" />
>>                        <dependency org="org.slf4j" name="slf4j-log4j12"
>> rev="1.6.4"
>> conf="compile->*" />
>>                        <dependency org="log4j" name="log4j" rev="1.2.16"
>> conf="compile->*,!sources,!javadoc">
>>                        <exclude module="jmxri" />
>>                        <exclude module="jmxtools" />
>>                        </dependency>
>>                        <dependency org="junit" name="junit" rev="4.8"
>> conf="test->*" />
>>                        <dependency org="javax.servlet"
>> name="javax.servlet-api"
>> rev="3.0.1" conf="provided->*">
>>                        <artifact name="javax.servlet-api" type="jar" />
>>                        </dependency>
>>                        ]]>
>>                </xsl:text>
>>
>> I am using text and CDATA, as you can see in my style sheet.
>> Is there a better way to output this without escaping the XML and
>> generate the indented XML ?
>
>
>
> Well the '>' sign does not need to be escaped but often is. So I don't see
> any problem with doing
>
>
>                             <dependency org="org.slf4j" name="slf4j-api"
> rev="1.6.4"
> conf="provided->*" />
>                             <dependency org="org.slf4j"
name="slf4j-log4j12"
> rev="1.6.4"
> conf="compile->*" />
>                             <dependency org="log4j" name="log4j"
> rev="1.2.16"
> conf="compile->*,!sources,!javadoc" >
>                             <exclude module="jmxri" />
>                             <exclude module="jmxtools" />
>                             </dependency>
>                             <dependency org="junit" name="junit" rev="4.8"
> conf="test->*" />
>                             <dependency org="javax.servlet"
> name="javax.servlet-api"
> rev="3.0.1" conf="provided->*">
>                             <artifact name="javax.servlet-api" type="jar"
/>
>                             </dependency>
>
> literally in your stylesheet code, the serializer might later escape the
'>'
> signs '&gt;'.
>
> If you want to use less than signs '<' then you need to escape them e.g
>  <foo att="a &lt; b"/>
> that is an XML syntax requirement and not specific to XSLT.
>
>
> --
>
>        Martin Honnen --- MVP Data Platform Development
>        http://msmvps.com/blogs/martin_honnen/

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.