Re: [xsl] Problem with nested Stuff

Subject: Re: [xsl] Problem with nested Stuff
From: Jon Gorman <jonathan.gorman@xxxxxxxxx>
Date: Mon, 14 Nov 2005 13:40:06 -0600
I don't see anything nested "stuff" here (besides the input xml, but
it's not a nesting problem).  Are you asking how to get a value out of
an attribute?  Rather basic and faq question.  @foo will give the
value.  So you can just do a varient of the identity transformation
for this.

So something like:

<xsl:template match="*">
<xsl:choose>
<xsl:when test="@myid">
<xsl:copy>{<xsl:value-of select="@myid" />}</xsl:copy>
</xsl:when>

<xsl:otherwise>
<xsl:copy>
<xsl:apply-templates />
</xsl:copy>
</xsl:otherwise>

</xsl:template>

If there is an attribute called @myid, this template (untested, might
have typos) should get the value of @myid instead of the value of
applying templates to the children

Jon  Gorman

Current Thread