[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Mike,
At 07:32 PM 9/7/2005, you wrote:
It is possible.
You haven't shown us the template matching "Name".
Combined with your template above, this template
will result in
FooXXX
but this template
will result in
<Name>FooXXX</Name>
while
will result in
<BANG>FooXXX</BANG>
As near as I can understand it, you are asking the XSLT to do something it does quite naturally. But it's hard to determine what your actual criteria are from this description.
Again, I'm not sure of the actual problem here. XSLT provides a "for-each" instruction to allow you to avoid writing templates that are only used once, in a single context. But I suspect that's actually a red herring in your case.
If the problem isn't yet solved, could we trouble you to repost a demonstration?
RE: [xsl] Apply-templates - how to omit top level element tags?
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 |
Mike,
At 07:32 PM 9/7/2005, you wrote:
Also, why is it not possible to be able to output:
FooXXX
When you start with
<Name>Foo<myns:MyX></Name>
It is possible.
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
You haven't shown us the template matching "Name".
Combined with your template above, this template
<xsl:template match="Name"> <xsl:apply-templates/> </xsl:template>
will result in
FooXXX
but this template
<xsl:template match="Name"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template>
will result in
<Name>FooXXX</Name>
while
<xsl:template match="Name"> <BANG> <xsl:apply-templates/> </BANG> </xsl:template>
will result in
<BANG>FooXXX</BANG>
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.
As near as I can understand it, you are asking the XSLT to do something it does quite naturally. But it's hard to determine what your actual criteria are from this description.
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?
Again, I'm not sure of the actual problem here. XSLT provides a "for-each" instruction to allow you to avoid writing templates that are only used once, in a single context. But I suspect that's actually a red herring in your case.
If the problem isn't yet solved, could we trouble you to repost a demonstration?
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 |