[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Re: namespaces and xsl:template match


Subject: [xsl] Re: namespaces and xsl:template match
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Fri, 11 Apr 2003 23:09:50 +0200

You are associating the prfix "UML" to two different namespaces
(respectively in the source.xml and in the stylesheet):

>  xmlns:UML = 'org.omg.xmi.namespace.UML'

and

> xmlns:UML="http://org.omg/UML/1.3"

So, in your stylesheet you are trying to match elements in the
"http://org.omg/UML/1.3" namespace, but there are no such elements in your
source.xml.

Remember: It is the namespace-uri that forms the expanded name of an
element -- the prefix does not matter at all and is used just for
convenience.

As a first step to correcting the problem, the "UML" namespace definition in
the stylesheet must be changed to be identical to the one used in the source
xml document.


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL


"Christof Schneider" <Christof_Schneider@xxxxxx> wrote in message
news:JAEAKHJDAODPKBJOMLMGOEPIEEAA.Christof_Schneider@xxxxxxxxx
> Dear community,
>
> following an excerpt from an xmi-document, i want to
> transform:
>
> <?xml version = '1.0' encoding = 'UTF-8' ?>
> <XMI xmi.version = '1.2' xmlns:UML =
> 'org.omg.xmi.namespace.UML'
>   <XMI.header>
>     <XMI.documentation>
>     </XMI.documentation>
>   </XMI.header>
>   <XMI.content>
>     <UML:Model xmi.id = 'a1' name = 'Canoo' isSpecification
> = 'false' isRoot = 'false'
>       isLeaf = 'false' isAbstract = 'false'>
> ...
>
>       <UML:Namespace.ownedElement>
>         <UML:Class xmi.id = 'a4' name = 'Energie' visibility
> = 'public' isSpecification = 'false'
>           isRoot = 'false' isLeaf = 'false' isAbstract =
> 'false' isActive = 'false'>
>
>
>        ...
>
> and a xslt which looks like this:
>
> <xsl:stylesheet version="1.0"
>
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                 xmlns:UML="http://org.omg/UML/1.3"
>                 xmlns:zoph="http://zoph">
>
>    <xsl:output indent="no" method="xml"
> encoding="iso-8859-1"/>
>
>    <xsl:template match="XMI.header">
>    <header/>
>    <!-- ignore XMI.header section -->
>    </xsl:template>
>
>    <xsl:template match="XMI.content">
>    <content/>
>    <xsl:apply-templates/>
>    </xsl:template>
>
>    <xsl:template match="UML:Namespace.ownedElement">
>    <ownedElement/>
>    <xsl:apply-templates/>
>    </xsl:template>
>
>    <!-- xsl:template match="UML:*">
>    <test/>
>    <xsl:apply-templates/>
>    </xsl:template -->
>
>    <xsl:template match="UML:Class">
>    <zoph:element>
>    <xsl:attribute name="name"><xsl:value-of
> select="./@name"/></xsl:attribute>
>    </zoph:element>
>    </xsl:template>
>
>    <xsl:template match="UML:Model">
>    <xsl:apply-templates/>
>    </xsl:template>
>
> When processing this xslt does not produce any output. When
> I change the <xsl:template
> match="UML:Namespace.ownedElement"> to <xsl:template
> match="UML_Namespace.ownedElement"> it produces output, but
> sure, not I am wanting.
>
> How to process namespaceprefixed tags like <UML:Model>?
> Where to pay attention? Is my understanding wrong to use
> xsl:template match="UML:.... or "UML:*" for all?
>
> Using ant and xalan 2 fyi.
>
> Thanks in advance for your answer. Have a nice weekend!
>
> - Christof
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords