Click to See Complete Forum and Search --> : can someone tell me what's wrong with this xslt file?


willms_jay
05-13-2003, 12:51 PM
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/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">

<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>

khalidali63
05-13-2003, 01:02 PM
you need to post it somewhere,you can find people who have used these propritery tags....

the best place I can recomend is here.

http://www.mulberrytech.com/xsl/xsl-list/index.html

The above is probably as good as it can get for xsl/xslt/xpath,xsl-fo support.