[xsl] Re: xsl-list Digest 11 Jun 2008 05:10:01 -0000 Issue 1525

Subject: [xsl] Re: xsl-list Digest 11 Jun 2008 05:10:01 -0000 Issue 1525
From: milo@xxxxxxxxxx
Date: Wed, 11 Jun 2008 08:46:13 -0400
I need to modify this style sheet, can I

set the y position of <Group> 'for each select artist' to be value of
<Artist_Year> - 1900

and if two or more <Artist_Year> values are equal, offset each
subsequent node by 6 on the x axis?

Here's the style sheet:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output media-type="model/x3d=xml"
doctype-system="http://www.web3d.org/specifications/x3d-3.2.dtd";
method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>

<xsl:template match="/">

<X3D profile="Immersive">&#10;

            <head>&#10;<title/></head>
                <Scene>

<xsl:apply-templates/>

                </Scene>
        </X3D>

</xsl:template>

<xsl:template match="artists">

<Group>

<xsl:for-each select="artist">

<Transform translation='0 0 0'>

            <xsl:attribute name="translation"><xsl:text> 0
</xsl:text><xsl:value-of select="(position() -1) * 6 + 2"/><xsl:text>
0 </xsl:text></xsl:attribute><!! --- This line here is where i need
the change --!!>
                <Shape>
                      <Appearance>
                                       <xsl:element name="ImageTexture">
                                      <xsl:attribute name="url">
                                         <xsl:value-of
select="Artist_Image"/>
                                       </xsl:attribute>
                                    </xsl:element>


<Material containerField='material' ambientIntensity='0.2' shininess='0.2' diffuseColor='1 .5 0'/> </Appearance>

                      <Box containerField='geometry' size='3 3 0.1'/>
                </Shape>
        </Transform>

        <Transform  translation='0 1.1 0'>
           <xsl:attribute name="translation"><xsl:text> 2
</xsl:text><xsl:value-of select="(position() -1) *6 + 1.1"/><xsl:text>
0 </xsl:text></xsl:attribute>
               <Shape>
                    <Appearance>

<Material containerField='material' ambientIntensity='0.2'
shininess='0.2' diffuseColor='255 255 255'/>

                    </Appearance>
<xsl:element name="Text">
                                        <xsl:attribute name="string">
                                                <xsl:value-of
select="Artist_Year"/>
                                        </xsl:attribute>

                                  <FontStyle
containerField='fontStyle' family='Arial' style='PLAIN'
justify='"BEGIN" "BEGIN"' size='0.6' spacing='1'/>

                                    </xsl:element>
                </Shape>
        </Transform>

           <Transform  translation='0 0.4 0'>
           <xsl:attribute name="translation"><xsl:text> 2
</xsl:text><xsl:value-of select="(position() -1) * 6 +
0.4"/><xsl:text> 0 </xsl:text></xsl:attribute>
               <Shape>
                    <Appearance>

                     <Material containerField='material'
ambientIntensity='0.2' shininess='0.2' diffuseColor='255 255 255'/>

                    </Appearance> <xsl:element name="Text">
                                        <xsl:attribute name="string">
                                                <xsl:value-of
select="Artist_Country"/>
                                        </xsl:attribute>

                                  <FontStyle
containerField='fontStyle' family='Arial' style='PLAIN'
justify='"BEGIN" "BEGIN"' size='0.6' spacing='1'/>

                                    </xsl:element>
                </Shape>
        </Transform>
    </xsl:for-each>
    </Group>
</xsl:template>

</xsl:stylesheet>

Current Thread