[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

namespace frustration


Subject: namespace frustration
From: "Mark D. Anderson" <mda@xxxxxxxxxxxxxx>
Date: Sun, 21 Nov 1999 22:39:26 -0800

suppose i would like the convenience of not specifying a prefix
for either my match expressions or my output literals, and
those namespaces are different. i can't, right?

see below for an example (note how the "thing" template does
not match). it appears i'm going to have to
pollute all my match and select expressions with prefixes,
just because my input and output namespaces aren't the same.

and what's up with the html output having those namespace
declarations? how do i declare an input namespace that i
do *not* want declared in my html output?

-mda

<!-- foobar.xsl -->
<?xml version="1.0" ?>

<xsl:stylesheet 
  version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns="urn:discerning.com/something"
  xmlns:something="urn:discerning.com/something" 
>

  <xsl:output
     method="html"
     indent="yes"
     doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN"/>
  
  <xsl:template match="/">
    <html>
     <xsl:apply-templates select="thing"/>
    </html>
  </xsl:template>

  <xsl:template match="thing">
     template without namespace matched: <xsl:value-of select="."/>
  </xsl:template>

  <xsl:template match="something:thing">
       template with namespace matched: <xsl:value-of select="."/>
  </xsl:template>
</xsl:stylesheet>

<!-- foobar.xml -->
<?xml version='1.0' encoding='UTF-8'?>
<things xmlns="urn:discerning.com/something">
  <thing>thing 1</thing>
  <thing>thing 2</thing>
</things>

<!-- xt-19991105 output -->

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns:something="urn:discerning.com/something" xmlns="urn:discerning.com/something">
</html>

     


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread