473,387 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

But it works without a namespace

I have recently come to peace with XML namespaces and have switch to
always ripping them out to using them. Has not been too bad but some
things I use to do no longer work.

Given this XML:

<?xml version="1.0"?>
<UpdateManifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/
updatemanifest">
<UpdateFiles>
<UpdateFile>
<Id>dbc5f337-176e-486f-95f9-83a997256417</Id>
<UpdateFileName>generic3.exe</UpdateFileName>
</UpdateFile>
</UpdateFiles>
<Updates>
<Update>
<Id>f428a425-82d5-484a-8a81-1b0bf7097b77</Id>
<FileId>d2aac5f1-559b-4b47-bddd-a2ed455d251a</FileId>
</Update>
</Updates>
</UpdateManifest>

And this XSL:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:m="http://tempuri.org/updatemanifest"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="4.0" encoding="iso-8859-1"
indent="no"/>
<xsl:template match="/">
<table class="TableListing" cellpadding="0" cellspacing="0"
border="2">
<xsl:for-each select="/m:UpdateManifest/m:Updates/m:Update">
<tr>
<td>
<xsl:variable name="curfileid" select="m:FileId"/>
<xsl:value-of select="/m:UpdateManifest/m:UpdateFiles/
m:UpdateFile[m:Id = $curfileid]/m:UpdateFileName"/>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>

The select "/m:UpdateManifest/m:UpdateFiles/m:UpdateFile[m:Id =
$curfileid]/m:UpdateFileName" does not return anything.

If I remove xmlns="http://tempuri.org/updatemanifest" from the xml and
all the "m:" namespace stuff from the XSL, it works as expected
(returns 'generic3.exe'). I am using XslCompiledTransform.

Any ideas what is up here. If not I guess I will go back to being a
namespace stripper.

Nathan

Feb 16 '07 #1
1 1581
nh****@gmail.com wrote:
<UpdateManifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/
updatemanifest">
<UpdateFiles>
<UpdateFile>
<Id>dbc5f337-176e-486f-95f9-83a997256417</Id>
<UpdateFileName>generic3.exe</UpdateFileName>
</UpdateFile>
</UpdateFiles>
<Updates>
<Update>
<Id>f428a425-82d5-484a-8a81-1b0bf7097b77</Id>
<FileId>d2aac5f1-559b-4b47-bddd-a2ed455d251a</FileId>
</Update>
</Updates>
</UpdateManifest>

And this XSL:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:m="http://tempuri.org/updatemanifest"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="4.0" encoding="iso-8859-1"
indent="no"/>
<xsl:template match="/">
<table class="TableListing" cellpadding="0" cellspacing="0"
border="2">
<xsl:for-each select="/m:UpdateManifest/m:Updates/m:Update">
<tr>
<td>
<xsl:variable name="curfileid" select="m:FileId"/>
So for the above XML sample the variable is
"d2aac5f1-559b-4b47-bddd-a2ed455d251a"
then you compare to
<xsl:value-of select="/m:UpdateManifest/m:UpdateFiles/
m:UpdateFile[m:Id = $curfileid]/m:UpdateFileName"/>
"dbc5f337-176e-486f-95f9-83a997256417"
which is different.


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Feb 16 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: atomo | last post by:
Hi, i'm wondering why this hiding and showing function works on IE (6) but it doesn't work in Mozilla Firebird (0.7) function fnc_show(num){ for(i=1;i<7;i++){ eval("t_" + i + ".style.display...
8
by: Petter Reinholdtsen | last post by:
I ran into a problem on HP-UX 11.00 the other day, where it refused to compile a program using 'using namespace std;' at the top. The reason seem to be that the compiler refuses to accept 'using...
1
by: C Downey | last post by:
Is there a way to access my .vb class files in my codebehind pages without pre-compiling them first. We are working with multiple developers, so each time I make a change to the class file the...
0
by: Hilmar Demant | last post by:
Hi, i've experienced something weird, and its probably not an special ASP.NET-issue, but containing several techniques i think its adequate to post it here. Hopefully someone knows anything...
15
by: Phill. W | last post by:
Is anyone writing VB.Net (2003) code /without/ referencing the Microsoft.VisualBasic namespace(?), regardless of whether its Import'ed or not? The Powers That Be here are trying to introduce a...
2
by: Raf256 | last post by:
Hello, my custom streambuf works fine with output via << and with input via .get() but fails to input via >> or getline... any idea why? -------------------- A custom stream buffer (for...
1
by: Ethan Strauss | last post by:
Hi, I have a C#.net Web application which calls a web service (http://eutils.ncbi.nlm.nih.gov/entrez/eutils/soap/eutils.wsdl). It has run just fine for months. Recently I started getting...
7
by: dlasusa | last post by:
Sorry if this is the wrong group...I THINK I got to the right place...(oh...and I'm a newbie programmer...so please be gentle) Anyway I have a program that works fine when I run it from within...
25
by: samjnaa | last post by:
Please check for sanity and approve for posting at python-dev. In Visual Basic there is the keyword "with" which allows an object- name to be declared as governing the following statements. For...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.