can someone tell me what's wrong with this xslt file?

admin

Administrator
Staff member
can anyone identify what's wrong with the XSLT file. It passes the well formed check in XMLSPY, but bunks out on this line when I validate :

<xsl:apply-templates select="cancore:general" />


saying 'unexpected child element'

any clues?

here's the xsl file :
(note that I am not concerned with the transformation here, just the structure of the xslt documnet)



<xsl:stylesheet xmlns:cancore="http://www.imsglobal.org/xsd/imsmd_v1p2" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method = "xml" indent = "yes"/>

<!-- apply the templates at the root level -->
<xsl:template match="cancore:lom">
<metadata>
<!-- make the brace for the content -->

<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ <!-- m --><a class="postlink" href="http://www.openarchives.org/OAI/2.0/oai_dc.xsd">http://www.openarchives.org/OAI/2.0/oai_dc.xsd</a><!-- m -->">

<xsl:apply-templates select="cancore:general" />
<xsl:apply-templates select="cancore:lifecycle/cancore:contribute" />

</oai_dc:dc>
</metadata>
</xsl:template>

<!-- handle all the important information within the general tag! -->
<xsl:template match="cancore:general">
<!-- title is a required field, no test required here -->
<dc:title>
<xsl:apply-templates select="cancore:title/cancore:langstring" />
</dc:title>
<dc:description>
<xsl:apply-templates select="cancore:description/cancore:langstring" />
</dc:description>
</xsl:template>

<!-- handle all the important information within the lifecycle/role tag! -->
<xsl:template match="cancore:lifecycle/cancore:contribute">
<!-- Get the creator tag information , it is optional so test -->
<xsl:if test="cancore:role/cancore:value/cancore:langstring = 'Author'">
<dc:creator>
<xsl:value-of select="cancore:centity/cancore:vcard" />
</dc:creator>
</xsl:if>

<!-- Get the publisher tag information, it is optional so test -->
<!-- Get the publisher tag information, it is optional so test -->
<xsl:if test="cancore:role/cancore:value/cancore:langstring = 'Publisher'">
<dc:publisher>
<xsl:value-of select="cancore:centity/cancore:vcard" />
</dc:publisher>
<dc:date>
<xsl:value-of select="cancore:date" />
</dc:date>
</xsl:if>

</xsl:template>



</xsl:stylesheet>
 
Back
Top