what is the best way to include a htlm entity in XSLT?
<xsl:template match="/a/node">
<xsl:value-of select="."/>
<xsl:text> </xsl:text>
</xsl:template>
this one returns a XsltParseError
-
You can use CDATA section
<xsl:text disable-output-escaping="yes"><![CDATA[ ]]></xsl:text>or you can describe   in local DTD:
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>or just use
 instead of From aku -
this one returns a XsltParseError
Yes, and the reason for that is that
is not a predefined entity in XML or XSLT as it is in HTML.You could just use the unicode character which
stands for: From Tom Lokhorst -
one other possibility to use html entities from within xslt is the following one:
<xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>From Pierre Spring -
XSLT only handles the five basic entities by default:
lt,gt,apos,quot, andamp. All others need to be defined as @Aku mentions.From samjudson -
Now that there's Unicode, it's generally counter-productive to use named character entities. I would recommend using the Unicode character for a non-breaking space instead of an entity, just for that reason. Alternatively, you could use the entity
 , instead of the named entity. Using named entities makes your XML dependent on an inline or external DTD.From James Sulak
0 comments:
Post a Comment