Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Possible to keep a variable value after for-each

From: Gina_Marano <ginalster@-----.--->
To: NULL
Date: 5/4/2009 10:44:00 AM
Thanks,

It wasn't mean to be literal, it was pseudocode.

I will go over your post!

Thanks much!

~Gina_M~

On May 1, 3:56=A0am, Martin Honnen <mahotr...@yahoo.de> wrote:
> Gina_Marano wrote:
> > ok, I will try to make an example:
>
> > <parts>
> > =A0 <component>
> > =A0 =A0 <description>Item123_cover</description>
> > =A0 =A0 <color>white</color>
> > =A0 =A0 <weight>80</weight>
> > =A0 <component>
> > =A0 <component>
> > =A0 =A0 <description>Item123_block</description>
> > =A0 =A0 <weight>100</weight>
> > =A0 =A0 <pagecount>156</pagecount>
> > =A0 <component>
> > </parts>
>
> > -note, the above can be in any order
>
> > generating:
>
> > <order>
> > =A0 <cover>
> > =A0 =A0 <color>white</color>
> > =A0 =A0 <case>(if Item123_block.weight =3D 100 then 'A' if
> > Item123_block.weight =3D 80 then 'B')</case>
> > =A0 </cover>
> > =A0 <block>
> > =A0 =A0 <pagecount>156</pagecount>
> > =A0 =A0 <weight>100</weight>
> > =A0 =A0 <size>8x11</size>
> > =A0 </block>
> > <block>
>
> > NOTE: the <cover><case> is dependant on the Item123_block's =A0weight.
>
> I am not sure whether the contents of the case element is meant to be
> literal content you want to generate or some attempt to use a pseudo
> code language to show what you want.
>
> In case that is meant literal then here is a stylesheet:
>
> <xsl:stylesheet
> =A0 =A0xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform"
> =A0 =A0version=3D"1.0">
>
> =A0 =A0<xsl:output method=3D"xml" indent=3D"yes"/>
>
> =A0 =A0<xsl:template match=3D"parts">
> =A0 =A0 =A0<order>
> =A0 =A0 =A0 =A0<xsl:variable name=3D"b" select=3D"component[contains(desc=
ription,
> 'block')]"/>
> =A0 =A0 =A0 =A0<xsl:variable name=3D"c" select=3D"component[contains(desc=
ription,
> 'cover')]"/>
> =A0 =A0 =A0 =A0<xsl:variable name=3D"A" select=3D"&quot;'A'&quot;"/>
> =A0 =A0 =A0 =A0<xsl:variable name=3D"B" select=3D"&quot;'B'&quot;"/>
> =A0 =A0 =A0 =A0<cover>
> =A0 =A0 =A0 =A0 =A0<xsl:copy-of select=3D"$c/color"/>
> =A0 =A0 =A0 =A0 =A0<case>
> =A0 =A0 =A0 =A0 =A0 =A0<xsl:value-of select=3D"concat('(if ', $b/descript=
ion,
> '.weight =3D ', $b/weight, ' then ', $A, ' if ', $b/description,
> '.weight =3D ', $c/weight, ' then ', $B, ')')"/>
> =A0 =A0 =A0 =A0 =A0</case>
> =A0 =A0 =A0 =A0</cover>
> =A0 =A0 =A0 =A0<block>
> =A0 =A0 =A0 =A0 =A0<xsl:copy-of select=3D"$b/pagecount"/>
> =A0 =A0 =A0 =A0 =A0<xsl:copy-of select=3D"$b/weight"/>
> =A0 =A0 =A0 =A0 =A0<size>8x11</size>
> =A0 =A0 =A0 =A0</block>
> =A0 =A0 =A0</order>
> =A0 =A0</xsl:template>
>
> </xsl:stylesheet>
>
> --
>
> =A0 =A0 =A0 =A0 Martin Honnen --- MVP XML
> =A0 =A0 =A0 =A0http://msmvps.com/blogs/martin_honnen/- Hide quoted text -
>
> - Show quoted text -



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent