xsl-list
[Top] [All Lists]

different versions of xmlns:foo are never usable together?

2005-07-14 08:19:28
I'm working on a project that's using XML & XSLT to do lots of munging
of files.  I've run into an odd problem that I'm hoping isn't a issue of
who-controls-what.

For example, I've got two files with recipes in them, cake.xml and
muffin.xml.

In cake.xml is
   <food:recipe xmlns:food="http://who/knows/Food/1.0";> ... </food:recipe>

In muffin.xml is
   <food:recipe xmlns:food="http://who/knows/Food/1.1";> ... </food:recipe>

I'd like to use both of them on a style sheet like:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0"
        xmlns:food="http://who/knows/Food/1.0";>
 <xsl:output method="text" encoding="UTF-8"/>
 <xsl:strip-space elements="*"/>
 <xsl:template match="food:recipe">
  <xsl:value-of select="food:name"/>: <xsl:value-of select="food:calories"/>
 </xsl:template>
</xsl:stylesheet>

But the xmlns:food string not being the same makes is selective over
which it's willing to use.

I understand the basic rule that xmlns:food has to be the same to be
honored.  However, this would seem to never allow for backwards
compatibility.  If I want version 2.0 of the 'food' namespace to accept
everything 1.0 did, but also add stuff like <food:wine-suggestions/>, is
it possible?  My stylesheet is interested in some basic bits that're
true of both versions.

I understand that xmlns:food's contents are irrelevant, and that they're
supposed to match.  But this would mean the moment I update my
RecipePrinter app to a newer version which includes some newer recipes,
I have to convert or get rid of all older recipes.

Please tell me I'm missing something. :-)
Thanks,
B
P.S. It'd be cool if I could do
     xmlns:food="http://.../1.0 http://.../2.0";
to cite a union of namespaces I can accept.  But that seems to threaten
to have lots of problems.


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>