Subject: Re: [xsl] Transforming Learning Object Metadata (LOM) problem. From: "Jaebin Lee" <jaebin.charade@xxxxxxxxx> Date: Tue, 12 Sep 2006 00:37:18 +0200 |
Thank you. I made some progress with declararing the namespace for lom in that I now get some data outputs from LOM xml. You mentioned that I need to add namespace "l:" to every elements that references lom namespace, so I tried putting prefix to every match statement that originates from 'lom' but because prefixing at different match statements gave me all the different outputs which still confuses me. For example below is part of my xsl which starts from matching lom and have additional match and apply-templates statements from it (actually all of matching and apply-template statements from my xsl are these). Is it required to put lom namespace in front of every element in match statements in order to work? I believe this also applies to "apply-template" statements, so for example would I need to put namespace prefix to <xsl:apply-templates select="lom"/> or <xsl:apply-templates select="general"/> as well? so that they would be select=" l: (element-name) " .
I was confused again after trying many things for right output with no progress... Could anybody give hints for this again? I'd really appreciate it. <!-- XSL part --> <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="//general/identifier/*" use="name()"/> <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <ROWSET> <xsl:apply-templates select="lom"/> </ROWSET> </xsl:template> <xsl:template match="lom"> <ROW><xsl:apply-templates select="general"/> </ROW> </xsl:template> <xsl:template match="general"> <xsl:apply-templates select="identifier"/> <xsl:apply-templates select="title"/> <xsl:apply-templates select="description"/> <xsl:apply-templates select="keyword"/> </xsl:template>
Thank you. -Jaebin
> The XSL I wrote starts with this declaration under: > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:fo="http://www.w3.org/1999/XSL/Format">
That's your problem. You don't want the xmlns:fo namespace as you are generating XHTMl not XSL-FO, so the only affect of having that namespace declaration is to add the same declaration to the output (making it technically invalid XHTML). But what you do need is a declaration for the http://ltsc.ieee.org/xsd/LOMv1p0 namespace as without that you can not refer to any elements in that namespace. add xmlns:l="http://ltsc.ieee.org/xsd/LOMv1p0" then you need to refer to LOM elements in the stylesheet as l:lom etc match="lom" matches lom in no-namespace so does not match your eleemnt match="l:lom" matches your element (even though it appears without prefix in your soyurce file) You need to prefix -_all_ references to elements in the lom namespace (or any namespace) in xslt1.
(The FAQ will have more examples, as this is the most F of the AQs.)
David
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Transforming Learning Obj, David Carlisle | Thread | Re: [xsl] Transforming Learning Obj, David Carlisle |
Re: [xsl] make recursive call, mary liu | Date | Re: [xsl] Transforming Learning Obj, David Carlisle |
Month |