Subject: Re: [xsl] Target Namespace in XML breaks XSL transform From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Fri, 24 Mar 2006 14:06:20 -0500 |
When I specify a target namespace for the root element in my XSL document,
e.g. <Events xmlns="urn:cde.berkeley.edu:babl:events:1.00" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:cde.berkeley.edu:babl:events:1.00 UCBEvents.xsd">
it appears that I then need to use a namespace prefix for every element from that document referenced in my XSL transform.
So I can't do this: <xsl:value-of select="Events/View/FormatCalendar/ShortName"/>
But instead have to do this: <xsl:value-of select="ev:Events/ev:View/ev:FormatCalendar/ev:ShortName"/>
This is a huge stylesheet and there are three different stylesheets I'd have to modify, so to do this MANY changes will have to be made.
I need the target namespace in my XML document if I want to validate it. Is there any way around modifying all my XSLs?
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="text()|comment()|processing-instruction()"> <xsl:copy/> </xsl:template>
<xsl:template match="*"> <xsl:element name="{local-name(.)}"> <xsl:apply-templates select="@*|node()"/> </xsl:element> </xsl:template>
<xsl:template match="@*"> <xsl:attribute name="{local-name(.)}"> <xsl:value-of select="."/> </xsl:attribute> </xsl:template>
-- Upcoming XSLT/XSL-FO hands-on courses: Washington,DC 2006-06-12/16 World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Target Namespace in XML break, Allison Bloodworth | Thread | RE: [xsl] Target Namespace in XML b, Michael Kay |
[xsl] Target Namespace in XML break, Allison Bloodworth | Date | Re: [xsl] Conditional statements in, David Carlisle |
Month |