xsl-list
[Top] [All Lists]

Re: [xsl] I need advice on building an XSL stylesheet

2009-03-05 14:45:48
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(_at_)CraneSoftwrights(_dot_)com
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>