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

Subject: Re: [xsl] Transforming Learning Object Metadata (LOM) problem.
From: "Jaebin Lee" <jaebin.charade@xxxxxxxxx>
Date: Tue, 12 Sep 2006 10:00:41 +0200
Thanks.
Thank you.
I think I'm almost to what I want, but still having problem with keys.
I'm confused in how to deal with x-path that I'm using match of <xsl:key>

In my file, I have,,

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:l =
"http://ltsc.ieee.org/xsd/LOMv1p0";>
					
	<xsl:key name="gen-identifier" match="//l:general/identifier/*" use="name()"/>

... and some html and matching stuffs...

  <xsl:apply-templates select="l:lom"/>
	
  <xsl:template match="l:lom">
	<xsl:apply-templates select="l:general"/>
  </xsl:template>

  <xsl:template match="l:general">
	 <xsl:apply-templates select="l:identifier"/>
  </xsl:template>

<xsl:template match="l:identifier | l:title | l:description |
l:keyword | l:version | l:source">
	<xsl:choose>
	   <xsl:when test="name() = 'identifier' ">
		<xsl:for-each select="* [ count( . | key( 'gen-identifier', name()
)[1] ) = 1 ] ">
			&lt;FIELD name="<xsl:value-of select="local-name()"/>&gt;<br/>
			<xsl:for-each select="key('gen-identifier', local-name())">
			       <xsl:value-of select="current()"/><br/>
			</xsl:for-each>
			&lt;/FIELD&gt;<br/>
		</xsl:for-each>

so on.......

In the key declaration,
<xsl:key name="gen-identifier" match="//l:general/identifier/*" use="name()"/>
1. what would be the right way to put "l" prefix in match?
2. does it have to be also applied to name?
3. and when you actually use key element in template, how should the
prefix applied to?
4. Lastly, in test statement, I compare name with certain string, and
does that not need to have any namespace prefix I believe? is that
correct?

Could anyone please give a hint?
Thank you!

-Jaebin


On 9/12/06, David Carlisle <davidc@xxxxxxxxx> wrote:


> I believe this also applies to "apply-template" statements, so for
> example would I need to put namespace prefix to

yes in both select expressions (including use= and test= attribute) and
match expresions in templates and keys, you need to use prefixes to
refer to an element in a namespace, otherwise you are refering to
elements in no-namespace.

David

Current Thread