Bug 6594: Schema.org span nesting improvements

So, it turns out that the <a href> was causing a new "chain" to be
invoked, thus nesting the <span> elements for properties within the <a
href> actually caused the properties to be attached to that new chain
rather than the containing object. Therefore, wrap the <span> elements
around the <a href> elements where applicable.

Thanks to Manu Sporny in #rdfa for helping me to sort this out.

Signed-off-by: Dan Scott <dan@coffeecode.net>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
I tested by validating against the Google rich snippet tool,
validator.nu, and linter.structured-data.org. All were satisfied
with the microdata markup, and the properties that are set make
sense.

These patches are only for MARC21 XSLT view, but I think it is worth
pushing them even without the NORMARC and UNIMARC markup, so that
people can start to test out schema.org microdata in Koha, and
refine the implementation.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

FWIW I agree with Jared, it is essentially a no-op in terms of what
the user sees, so is safe.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Dan Scott 2013-08-22 11:47:12 -04:00 committed by Galen Charlton
parent 1a50854d4f
commit fa68cda549

View file

@ -336,13 +336,11 @@
</xsl:if> </xsl:if>
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
<xsl:if test="marc:subfield[@code='b']"> <xsl:if test="marc:subfield[@code='b']">
<a href="/cgi-bin/koha/opac-search.pl?q=pb:{marc:subfield[@code='b']}"> <span property="name"><a href="/cgi-bin/koha/opac-search.pl?q=pb:{marc:subfield[@code='b']}">
<span property="name">
<xsl:call-template name="subfieldSelect"> <xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">b</xsl:with-param> <xsl:with-param name="codes">b</xsl:with-param>
</xsl:call-template> </xsl:call-template>
</span> </a></span>
</a>
</xsl:if> </xsl:if>
</span> </span>
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
@ -546,6 +544,7 @@
<xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6']"> <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6']">
<span class="results_summary subjects"><span class="label">Subject(s): </span> <span class="results_summary subjects"><span class="label">Subject(s): </span>
<xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']"> <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']">
<span property="keywords">
<a> <a>
<xsl:choose> <xsl:choose>
<xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'"> <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
@ -564,7 +563,6 @@
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="marc:subfield[@code='a']"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute> <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="marc:subfield[@code='a']"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<span property="keywords">
<xsl:call-template name="chopPunctuation"> <xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString"> <xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect"> <xsl:call-template name="subfieldSelect">
@ -574,8 +572,8 @@
</xsl:call-template> </xsl:call-template>
</xsl:with-param> </xsl:with-param>
</xsl:call-template> </xsl:call-template>
</span>
</a> </a>
</span>
<xsl:if test="marc:subfield[@code=9]"> <xsl:if test="marc:subfield[@code=9]">
<a class='authlink'> <a class='authlink'>
<xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute> <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>