[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: namespaces and xsl:template match

Subject: Re: namespaces and xsl:template match
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Fri, 11 Apr 2003 23:09:50 +0200
xmlns uml
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.