Subject: RE: [xsl] Apply-templates - how to omit top level element tags? From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Thu, 08 Sep 2005 14:22:40 -0400 |
Also, why is it not possible to be able to output:
FooXXX
When you start with
<Name>Foo<myns:MyX></Name>
Where the XSL has this:
<xsl:template match="myns:MyX">XXX</xsl:template>
I either get:
<Name>FooXXX</Name>
Or just:
Foo
But not what I want, which is:
FooXXX
<xsl:template match="Name"> <xsl:apply-templates/> </xsl:template>
<xsl:template match="Name"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template>
<xsl:template match="Name"> <BANG> <xsl:apply-templates/> </BANG> </xsl:template>
Why do I have to write a specific template to accomplish this? In the case above I want to output the value contained in <Name> that way only once, but I also want the write of the XML to be able to embed other references into it that I can parse with apply-templates.
Having to create a template for a single case is like having to write a function in Java called Add37(x) simply to add 37 to the variable "x" in only one place in the code. Why can't I just do it inline rather than have to worry about logic in two places and also worry about potential sideaffects or name collisions? Is it because XSL simply doesn't provide such a capability?
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Apply-templates - how to , Jon Gorman | Thread | RE: [xsl] Apply-templates - how to , Mike Schinkel |
RE: [xsl] Apply-templates - how to , Wendell Piez | Date | Re: [xsl] How to do this without up, JBryant |
Month |