开发者

How can I manage microdata with xslt?

I'm trying to add a tag like

<div itemscope>

i开发者_StackOverflow中文版n my xslt transformation but I get an error.(The expected token is '=')

I'm working in C# .net 4.0 xslt 1.0.


XSLT is optimized for generating XML output. HTML5 is, in general, not XML. The syntax

<div itemscope>

is clearly not XML and therefore can't be generated using xsl:attribute. This is because XML doesn't support empty-valued attributes. That's the bad news.

The good news: There are two ways of writing the same thing as <div itemscope> that are valid HTML5 and valid XML:

<div itemscope="">
<div itemscope="itemscope">

So pick your favorite and generate that!


<xsl:text disable-output-escaping="yes"><![CDATA[<div itemscope>]]></xsl:text>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜