Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] XHTML to XHTML transform

From: "Andreas L. Delmelle" <a_l.delmelle@---------->
To:
Date: 4/2/2004 10:24:00 AM
> -----Original Message-----
> From: Jeffrey Moss [mailto:jeff@xxxxxxxxxxxx]
>
<snip />
> Well now you bring up some great points, what if I name my <box> element
> <mynamespace:box> ???
> Does that make things easier?
>

Hmm.. this is indeed definitely going to make it a lot easier. Personally, I
find it a lot more aesthetically pleasing ;)

> The solution I came up with is to use parameters wherever
> possible, since I
> wont need the empty template solution for that (although the option is
> available if I ever want to use text nodes...).
> but using the match *[namesapce-uri()='http://www.w3.org/1999/xhtml'] it
> looks like I could only apply the copy template to elements not in the
> "mynamespace:" namespace... is that right?
>

Yes. Say the uri for mynamespace:* is defined as

xmlns:mynamespace="my:namespace"

Then you can do:

<xsl:template match="*[not(namespace-uri()='my:namespace']" />

The downside is that, if you *do* need to access the nodes for their
content, you'll have to use either the fully qualified (prefixed)
'mynamespace:name/...', or do it like '*[local-name()="name"]/...', but this
could be worked around/eased up a bit if you define a variable or a key for
those elements. As an example:

<xsl:key name="myns-nodes" match="*[namespace-uri()='my:namespace']"
         use="local-name()" />

to acces a certain 'name' node in mynamespace: you can use

key('myns-nodes','name')[{predicate-here}]

Numerous possibilities..


Hope this helps!


Cheers,

Andreas


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent