[xsl] X3D stylesheet - value of, and offset

Subject: [xsl] X3D stylesheet - value of, and offset
From: milo@xxxxxxxxxx
Date: Wed, 11 Jun 2008 08:58:23 -0400
Hi,

I need to modify this stylesheet:

Here is some highly 'pseudo' code for what I'm trying to get

for each select artist <Group> attribute y translation = value of
<Artist_Year> - 1900

if <Artist_Year> = <Artist_Year>, x translation + 6

Here's the code: (there are comments below highlighting the lines that
need modification)

---------------

<?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'>


here is where i need the change-->


<xsl:attribute name="translation">
<xsl:text> 0 </xsl:text>
<xsl:value-of select="(position() -1) * 6 + 2"/>
<xsl:text> 0 </xsl:text>
</xsl:attribute> <--! to here? --!>

                <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"/> <!-- and this is the value i want
in the <Group> transform annotated above --!>
</xsl:attribute>
</xsl:element>
                </Shape>

</Transform>

    </xsl:for-each>
    </Group>
</xsl:template>

</xsl:stylesheet>

-------------

Any thoughts?

Best Regards
J Milo Taylor

Current Thread