Subject: Re: [xsl] Output < and > in the attribute from the style sheet From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Sat, 21 Apr 2012 13:15:03 +0200 |
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 ?
<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>
If you want to use less than signs '<' then you need to escape them e.g <foo att="a < 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Output < and > in the attribu, Mansour Al Akeel | Thread | Re: [xsl] Output < and > in the att, Mansour Al Akeel |
[xsl] Output < and > in the attribu, Mansour Al Akeel | Date | Re: [xsl] for-each-group grouping a, Graydon |
Month |