+ <!--
+ Provide the appropriate microdata for the provided element.
+ -->
+ <xslt:template match="*|text()" mode="microdata">
+ <xslt:param name="tagname"/>
+ <xslt:param name="namespace"/>
+ <xslt:param name="plaintext" select="false()"/>
+ <xslt:element name="{$tagname}" namespace="{$namespace}">
+ <xslt:if test="@lang">
+ <xslt:attribute name="xml:lang">
+ <xslt:value-of select="@lang"/>
+ </xslt:attribute>
+ </xslt:if>
+ <xslt:choose>
+ <xslt:when test="self::text()|self::html:title|self::html:time[not(@datetime)]">
+ <xslt:apply-templates select="." mode="text"/>
+ </xslt:when>
+ <xslt:when test="self::html:meta[@content]">
+ <xslt:value-of select="@content"/>
+ </xslt:when>
+ <xslt:when test="self::html:audio|self::html:embed|self::html:iframe|self::html:img|self::html:source|self::html:track|self::html:video">
+ <xslt:value-of select="@src"/>
+ </xslt:when>
+ <xslt:when test="self::html:a|self::html:area|self::html:link">
+ <xslt:value-of select="@href"/>
+ </xslt:when>
+ <xslt:when test="self::html:object">
+ <xslt:value-of select="@data"/>
+ </xslt:when>
+ <xslt:when test="self::html:data|self::html:meter">
+ <xslt:value-of select="@value"/>
+ </xslt:when>
+ <xslt:when test="self::html:time[@datetime]">
+ <xslt:value-of select="@datetime"/>
+ </xslt:when>
+ <xslt:otherwise>
+ <xslt:choose>
+ <xslt:when test="$plaintext">
+ <xslt:apply-templates mode="text"/>
+ </xslt:when>
+ <xslt:otherwise>
+ <xslt:if test="$namespace='&Atom;'">
+ <xslt:attribute name="type">xhtml</xslt:attribute>
+ </xslt:if>
+ <div xmlns="&xhtml;">
+ <xslt:apply-templates mode="content"/>
+ </div>
+ </xslt:otherwise>
+ </xslt:choose>
+ </xslt:otherwise>
+ </xslt:choose>
+ </xslt:element>
+ </xslt:template>
+