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

Re: [xsl] XSL new user question: no output from a simple XSLT


Subject: Re: [xsl] XSL new user question: no output from a simple XSLT
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 19 Sep 2007 10:36:43 -0400

At 2007-09-19 09:21 -0500, Dunk, Michael (Mike) wrote:
I'm new to XSLT, working my way through O'Reilly's XSLT and reading
Michael Kay's XSLT Reference. At the moment, I'm stuck on some simple
XSLT. I have looked through the dpawson.com  and
www.biglist.com/lists/xsl-list/archives/ for solutions but cannot find
anything that solves this problem.

Can anyone help?

The aim is to transform a complex xml file called
Subject_Area_Groups.xml, see below for a sample of this xml:


<?xml version="1.0" encoding="UTF-8"?> <Subject_Area_Groups xmlns="http://www.ca.com/erwin/data"

Your un-prefixed elements are in a non-null namespace.


The XSLT that I have written so far is:
...
<?xml version='1.0'?>

<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml"/>

<xsl:template match="/">

<xsl:apply-templates select="/Subject_Area"/>

You are pushing nodes in no namespace. (BTW, you don't need the leading slash)


Unfortunately, this is not giving any output.

Can anyone see what is wrong with the above XSLT?

The XSLT processor used was Saxon 8.8.0.4J.

In XSLT 2.0 you can set the value of the non-prefixed element names in XPath expressions by using the attribute in your xsl:stylesheet element (or anywhere in scope):


xpath-default-namespace="http://www.ca.com/erwin/data"

I hope this helps.

. . . . . . Ken

--
Upcoming public training: UBL and code lists Oct 1/5; Madrid Spain
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and 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 Jul'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


Current Thread
Keywords