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>
<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()"/>
<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 ] "> <FIELD name="<xsl:value-of select="local-name()"/>><br/> <xsl:for-each select="key('gen-identifier', local-name())"> <xsl:value-of select="current()"/><br/> </xsl:for-each> </FIELD><br/> </xsl:for-each>
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!
> 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Transforming Learning Obj, David Carlisle | Thread | Re: [xsl] Transforming Learning Obj, David Carlisle |
Re: [xsl] @xmlns retrieving value o, George Cristian Bina | Date | Re: [xsl] Problem using recursive a, George Cristian Bina |
Month |