Re: [xsl] Transforming Learning Object Metadata (LOM) problem.

Subject: Re: [xsl] Transforming Learning Object Metadata (LOM) problem.
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 12 Sep 2006 09:52:32 +0100
	<xsl:key name="gen-identifier" match="//l:general/identifier/*" use="name()"/>

If you need this key you need l:identifier not identifier.

However I strong;y suspect that you don't need a key at all, the useage
here is very strange. 
Match patterns never need to start with // (it makes no difference at
all whether the // is there)  Also normally (almost always) you don't
want to use name() in a stylesheet as that depends on namespace prefixes
which should not be ddepended on. an xpath selecting l:title
will match title in the lom namespaec whatever prefix (or no
prefix) is used in the source document, but a text of
name()='title' which is effectively what you have here will only match
unprefixed elements with name title, and will match them whatever
namespace they are in.

<xsl:template match="l:identifier | l:title | l:description |
l:keyword | l:version | l:source">
	<xsl:choose>
	   <xsl:when test="name() = 'identifier' ">

Why make a template matching 6 different elements only to have to choose
between them? If you must do this, as mentioned above dontt use name()
use
 test="self::identifier"
but it usually one would write
<xsl:template match="l:itentifier">
 ....

		<xsl:for-each select="* [ count( . | key( 'gen-identifier', name()
)[1] ) = 1 ] ">

I have no idea what you are trying to test here so i can;'t suggest an
alternative but a key indexes the whole document, so this looks at each
child of teh current node and then looks up the name of the child and
sees if there is a child of that name anywhere in the document (which
there must be, as there is one as the child of teh current node)
			&lt;FIELD n
Do you want to generate text here or an element? If you want to generate
an element don't use 	&lt;FIELD  use
<FIELD>

David

Current Thread