[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Transforming Learning Object Metadata (LOM) proble

Subject: Re: Transforming Learning Object Metadata (LOM) problem.
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 12 Sep 2006 09:52:32 +0100
Re:  Transforming Learning Object Metadata (LOM) proble
	<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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.