(Jordan Willms) writes:
> Hi there.
>
> I am working with lom metadata and I am a little confused with how to
> form the following xml element:
>
> <lom xmlns="http://www.imsglobal.org/xsd/imsmd_v1p2"
> xmlns
si="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.imsglobal.org/xsd/imsmd_v1p2
> imsmd_v1p2p2.xsd"/>
>
> I have the following so far:
>
> <xsl:element name="lom">
> <xsl:attribute namespace="xmlns"
> name="xsi">http://www.w3.org/2001/XMLSchema-instance</xsl:attribute>
>
> <xsl:apply-templates/>
> </xsl:element>
>
> but it creates some very strange results.
actually you shouldn't get a result at all, it is a syntax error to try
to generate an attribute with name xmlns. XML namespace declarations
are not attributes as far as Xpath is concerned, they can't be generated
with xsl:attribute, they don't show up if you select @*.
Just generate the attribute that you need (xsi:schemaLocation) any
needed xml namespace declarations will be generated automatically.
> Does anyone know how I could go
> about forming this tag? I know I could do it withou xsl:element, but I'd
> like to do everything by the books.
Not sure what you mean by "by the books" I'd expect most xslt books to
advise thatyou don't need to use xsl:attribute or xsl:element unless you
need to generate the element or attribute names dynamically.
The main idea of xslt is that the templates should look like a
"template" for part of your result document, so it would b emore natural
to just use the form you give at the top rather than using xsl:element.
>
> Any help would be greatly appretiated.
>
> Cheers!
>
> ..jordan willms
David