|
Subject: RE: [xsl] Identity Transformations revisited From: "Karl J. Stubsjoen" <karl@xxxxxxxxxxxxx> Date: Sat, 6 Mar 2004 10:58:35 -0700 |
This almost works:
<!-- main match for campaigns -->
<xsl:template match="campaign">
<xsl:for-each select="*">
<xsl:element name="{name()}">
<xsl:for-each select="@*">
<xsl:attribute name="{name(.)}"><xsl:value-of
select="."/></xsl:attribute>
</xsl:for-each>
<xsl:value-of select="."/>
</xsl:element>
</xsl:for-each>
</xsl:template>
But, not getting child elements. I'm getting the value from the child
elements, but the elements themselves are stripped. Output looks like this
(a table decleration with no TRs and TDs):
<< BEGIN SNIPPET >>
<table width="650" border="0" cellspacing="0" cellpadding="0">
Simple Marketing Level One:
$ 499.00 /six months
One Page Optimized Metatags based on Website
Content:
Keyword Research:
Development of keywords/phrases
based on website content
Guaranteed minimum of 25 first
page listings among the major search engines
<< END SNIPPET >>
Karl
-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Karl J.
Stubsjoen
Sent: Saturday, March 06, 2004 10:39 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Identity Transformations revisited
Hello,
Previously I had asked the question on how to identity transform the a XML
that has been passed in as a parameter. There was some mixed conclusions
whether you could or could not. For sure, I can treat this parameter as XML
and as a result tree.
Why can't I set up a for-each... and transform on each node and attribute of
the result tree? Maybe I can not push an apply-templates... but I should be
able to implicitly step through the source.
So I have this:
<xsl:apply-templates select="$c"/>
A correct template match is made here:
<xsl:template match="campaign">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
(the above doesn't seem to work...)
but couldn't I:
<xsl:template match="campaign">
<xsl:for-each select="*">
<xsl:copy-of select="."/>
</xsl:for-each
</xsl:template>
(but this is where I am not sure how to appropriately write the for-each..)
Any help would be appreciated.
Karl
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Identity Transformations revi, Karl J. Stubsjoen | Thread | RE: [xsl] Identity Transformations , Karl J. Stubsjoen |
| Re: [xsl] Please help. fixing white, J.Pietschmann | Date | RE: [xsl] Identity Transformations , Karl J. Stubsjoen |
| Month |