OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: XSL and Namespace Question

[ Lists Home | Date Index | Thread Index ]
  • From: "Steve Muench" <smuench@us.oracle.com>
  • To: "Michael Wiechers" <MichaelW@rga.com>
  • Date: Sun, 9 Apr 2000 17:57:34 -0700

Future XSL questions are best directed to xsl-list@mulberrytech.org

Here's some helpful hints...

| <NavigationElement xlink:href="index.xml" xlink:title="Overview"
| xml-href="true"/>
|
| I don't get the href value using <xsl:value-of select="@href"/>.

For the first one, you need to qualify href with xlink:href...

<?xml version="1.0"?>
<NavigationElement xmlns:xlink="urn:xlink"
     xlink:href="index.xml"
     xlink:title="Overview"
     xml-href="true"/>

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xlink="urn:xlink" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
  <xsl:template match="/NavigationElement">
    Href = <xsl:value-of select="@xlink:href"/>
  </xsl:template>
</xsl:stylesheet>

| <Meta xmlns="meta.dtd">
| <Title>
| title
| </Title>
| </Meta>
|
| <xsl:value-of select="Meta/Title"/>, works only if i remove the xmlns
| declaration.

For the second one, you're hitting a limitation of
XPath 1.0 regarding default namespaces. You must
explicitly associate a prefix with the namespace uri
"meta.dtd" and then use that prefix to find Meta/Title
as meta:Meta/meta:Title as in:

<Meta xmlns="meta.dtd">
 <Title>title</Title>
</Meta>

<?xml version="1.0"?>
<xsl:stylesheet xmlns:M="meta.dtd" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:template match="/">
    Title = <xsl:value-of select="M:Meta/M:Title"/>
  </xsl:template>
</xsl:stylesheet>

______________________________________________________________
Steve Muench, Lead XML Evangelist & Consulting Product Manager
Business Components for Java & XSQL Servlet Development Teams
Oracle Rep to the W3C XSL Working Group



***************************************************************************
This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS