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 ] "> 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) <FIELD n Do you want to generate text here or an element? If you want to generate an element don't use <FIELD use <FIELD> David
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format