Re: (dsssl) handling elements named as <rule:something>

Subject: Re: (dsssl) handling elements named as <rule:something>
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 07 Aug 2003 15:00:37 -0400
XSLT and XPath questions would be better posted to the following list:

http://www.mulberrytech.com/xsl/xsl-list

There are a number of subscribers who would enthusiastically respond to such questions.

There is also an *excellent* FAQ at:

http://www.dpawson.co.uk

At 2003-08-07 11:31 -0700, Abhijit Junnare wrote:
I have an XML file which has bunch of rules in it such
as

<rule:choose xmlns:rule="http:www.somthing.com/rule">
SOME TEXT
</rule:choose>

I am writing a stylesheet and I am in debugging
process. I want to display something whenever the
element <rule:choose> appears in the XML document. I
dont want to display the actual contents of this
element but just some generated text such as "This is
Choose rule" or something like this.
Is it possible to process such elements using XSL?

Absolutely.


I tried something like this

<xsl:template match="rule:Choose">
"THIS IS CHOOSE RULE"
</xsl:template>

Yes, this is the required template ... but the quotes are not necessary (unless, of course, you want the quotes).


But I get an error saying xmlns:rule not declared.
What do I need to do?

You have to declare the namespace in the stylesheet before you can use it in the XPath addresses in your stylesheet.


Is there any other way to handle such thing.

Nope! You've got it already.


I hope this helps.

.......................... Ken

--
Upcoming hands-on courses: in-house corporate training available;
North America public:                     XSLT/XPath Aug 12, 2003

G. Ken Holman                mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.         http://www.CraneSoftwrights.com/z/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6                      Definitive XSLT and XPath
ISBN 0-13-140374-5                              Definitive XSL-FO
ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
ISBN 1-894049-11-X              Practical Formatting Using XSL-FO
Member of the XML Guild of Practitioners:    http://XMLGuild.info
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/z/bc


DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist


Current Thread