i am using symbols > in xsl file , which work but when i am using like <= it shows nothing.
can anybody tell me , whats wrong with it <= and which alternat开发者_StackOverflow社区ive should i use?
<xsl:if test="price < 100">
<xsl:if test="price > 100">
An XSLT stylesheet must be a well-formed XML document. This is why the < character (and the & character) has to be escaped always when they are not in a CDATA section.
Use either:
<xsl:if test="price <= 100">
or, if you don't like escaping:
<xsl:if test="not(price > 100)">
The W3C XML spec says that a literal < is not allowed in an attribute (> is OK):
The replacement text of any entity referred to directly or indirectly in an attribute value must not contain a <.
So in the test attribute, you need to escape <. If your condition is price <= 100 then you would write it as:
<xsl:if test="price <= 100">
You should escape < to <, as you have in your first code example.
The > escape is >.
You should escape characters that have special meaning in XML - these are <>"'&.
Though in attributes, using > is fine.
See this SO question and answers.
加载中,请稍侯......
精彩评论