Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Possible to keep a variable value after for-each [Thread Next] Re: Possible to keep a variable value after for-eachTo: 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""'A'""/>
> =A0 =A0 =A0 =A0<xsl:variable name=3D"B" select=3D""'B'""/>
> =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 -
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
