[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: X3D XSLT - progress! next question!

Subject: Re: X3D XSLT - progress! next question!
From: "Dan Ochs" <dan.ochs@xxxxxxxxx>
Date: Wed, 4 Jun 2008 15:37:12 -0700
Re:  X3D XSLT - progress! next question!
I'm assuming you are referring to:
<Transform  translation='.8 4 1'>
          <xsl:attribute name="translation"><xsl:value-of
select="(position() -1 ) * 6"/>
          </xsl:attribute>

Depending on how you want to do the translation, your math code looks
fine, you could do
<Transform>
          <xsl:attribute name="translation"><xsl:value-of
select="(position() -1 ) * 6"/> 4 1</xsl:attribute>

to get:
<Transform translation='0 4 1'>...
<Transform translation='6 4 1'>...
<Transform translation='12 4 1'>...

make sense?

dan



Dan Ochs, Principal Consultant
Wrycan Inc.
http://xsl.wrycan.com
dan(dot)ochsatwrycan(dot)com

On Wed, Jun 4, 2008 at 5:03 AM, j milo taylor <milo@xxxxxxxxxx> wrote:
> Thanks to everyone, especially David, Darcy, Dean and Micheal who has helped
> me on this. After a few weeks of frustration, I finally got my head around
> XSLT a little bit.
>
> This now compiles and works, in a very basic way.
>
> The next question I need to resolve regards the "translation" attribute on
> line 22. I would like this spatial offset to be applied to the <Box Shape>
> node that follows, AND also to a number of subsequent nodes. In the code
> fragment below, there is a Text node for example which displays the Artist's
> Name (there will also be subsequent nodes e.g. <Artist_Year>,
> <Artist_Details>. Each of these needs to be offset by the same amount as the
> <Box Shape> node each time another <artist> is found in the XML.
>
> Related to this is another question. How could this transform be applied on
> the horizontal, rather than the vertical axis?
>
> Here's what I have:
>
> <?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='.8 4 1'>
>           <xsl:attribute name="translation"><xsl:value-of
> select="(position() -1 ) * 6"/>
>           </xsl:attribute>
>                           <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.200'
> shininess='0.200' diffuseColor='1 .50196 0'/>
>                               </Appearance>
>                                 <Box containerField='geometry' size='5 5
> 0.2'/>
>                           </Shape>
>       </Transform>
>                             <Transform  translation='2.9 2.6 0'>
>                                            <Shape>
>
>                               <Appearance>
>                                                               <Material
> containerField='material' ambientIntensity='0.200' shininess='0.200'
> diffuseColor='1 .50196 0'/>
>                               </Appearance> <xsl:element name="Text">
>                                       <xsl:attribute name="string">
>                                               <xsl:value-of
> select="Artist_Second_Name"/>
>                                       </xsl:attribute>
>                                   </xsl:element>
>
>                            </Shape>
>           </Transform>
>                               </xsl:for-each>
>                         </Group>   </xsl:template>
>
> </xsl:stylesheet>
>
> And some example XML:
>
> <?xml version="1.0" encoding="UTF-8" ?> <?xml-stylesheet type="text/xsl"
> href="XSLT/X3D-XSLT/X3D-XSLT_for_Test_Artist_Group002.xsl"?>
> <artists>
>   <artist>
>
> <Artist_Image>c://apache/htdocs/images/artists/Cunningham.jpg</Artist_Image>
>       <Artist_First_Name>David</Artist_First_Name>
>       <Artist_Second_Name>Cunningham</Artist_Second_Name>
>       <Artist_Year>1954</Artist_Year>
>       <Artist_Country>Ireland</Artist_Country>
>   </artist>
>    <artist>
>
> <Artist_Image>c://apache/htdocs/images/artists/Finer.jpg</Artist_Image>
>       <Artist_First_Name>Jem</Artist_First_Name>
>       <Artist_Second_Name>Finer</Artist_Second_Name>
>       <Artist_Year>1955</Artist_Year>
>       <Artist_Country>Ireland</Artist_Country>
>   </artist>
> </artists>
>
> People's comments about the dev environment I'm using have also been taken
> on board. Is there a general consensus over the suitablility of me using
> Saxon-B for this project?
>
> Thanks for any help.
> Best Regards
> Milo

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.