[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: I need advice on building an XSL stylesheet

Subject: Re: I need advice on building an XSL stylesheet
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 05 Mar 2009 14:45:10 -0500
Re:  I need advice on building an XSL stylesheet
Can you repost, please, with the markup visible?

At 2009-03-05 14:29 -0500, D P wrote:
I have the following XML code:
...
I am new to XSL and have been playing around with its syntax to modify (add) prefixes,

That is typically accomplished by reconstituting the elements with a new name that has a prefix:


   <xsl:template match="x">
     <xsl:element name="new:x" namespace="urn:x-new-namespace">
       ....

... or more generally:

   <xsl:template match="*">
     <xsl:element name="new:{local-name(.)}" namespace="urn:x-new-namespace">
       ....

trying to design a stylesheet that will transform the above XML code to the following output (note the prefixes added to certain nodes):

Okay, given that it is for only certain elements, you'll need something like:


   <xsl:template match="a | b | c | d">
     <xsl:element name="new:{local-name(.)}" namespace="urn:x-new-namespace">
       ....

I have not been successful in any attempt to add those prefixes to the XML output, and would like feedback on how to design such a style sheet that will enable me to accomplish my goal. I am using XSL version 1.0.

The above is XSLT 1.0 safe.


I hope this helps.

. . . . . . . . Ken

--
XQuery/XSLT training in Prague, CZ 2009-03 http://www.xmlprague.cz
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.