non-prefixed xmlns attribute

M

Michael TEpperis

hello,

my xml files starts with

+++++++
<?xml version='1.0' encoding='utf-8' ?>
<?integrity app='Visio' version='10.0' buildnum='525' metric='1'
key='004FEC3B329899673AA9E1A9C449A33530032E8409CF468FD94A9ED64401BE57D3481031BF2985FFCA9289E12A566C4F6ACCEAC545D0A4495E4BCEB25B859ED4'
keystart='261' ?>

<VisioDocument xmlns='urn:schemas-microsoft-com:eek:ffice:visio'>
<DocumentProperties>
....

++++++++

with the following xslt rule I don't have results:

<xsl:apply-templates select = "//DocumentProperties"/>

but if I erase the xmlns attribute, I succeed.

why?

tia

Michael Tepperis-von der Ohe
logicacmg - germany
 
R

Richard Tobin

Michael TEpperis said:
<VisioDocument xmlns='urn:schemas-microsoft-com:eek:ffice:visio'>
<DocumentProperties>

The name of this element is DocumentProperties in the namespace
urn:schemas-microsoft-com:eek:ffice:visio.
<xsl:apply-templates select = "//DocumentProperties"/>

This matches elements called DocumentProperties in no namespace.

To match elements in the namespace urn:schemas-microsoft-com:eek:ffice:visio,
you need to declare a prefix for it in the stylesheet and use that prefix:

<xsl:apply-templates xmlns:z="urn:schemas-microsoft-com:eek:ffice:visio"
select = "//z:DocumentProperties"/>

If you're going to use the prefix in other places too, declare it on the
stylesheet element.

-- Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top