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

RE: PARAMS and VARIABLES in XSL

Subject: RE: PARAMS and VARIABLES in XSL
From: mark bordelon <markcbordelon@xxxxxxxxx>
Date: Tue, 30 Jan 2007 13:14:51 -0800 (PST)
RE:  PARAMS and VARIABLES in XSL
Dave, thanks for the quick reply. This did not work.
It transformed to the following using Altova version
2007:

<?xml version="1.0" encoding="UTF-8"?><word
soundtime="preceding-sibling::sound[1]/@time"/>ja<word
soundtime="preceding-sibling::sound[1]/@time"/>ty<word
soundtime="preceding-sibling::sound[1]/@time"/>on<word
soundtime="preceding-sibling::sound[1]/@time"/>my<word
soundtime="preceding-sibling::sound[1]/@time"/>vy<word
soundtime="preceding-sibling::sound[1]/@time"/>oni<word
soundtime="preceding-sibling::sound[1]/@time"/>eto<word
soundtime="preceding-sibling::sound[1]/@time"/>to<word
soundtime="preceding-sibling::sound[1]/@time"/>zdjes`<word
soundtime="preceding-sibling::sound[1]/@time"/>tut<word
soundtime="preceding-sibling::sound[1]/@time"/>tam<word
soundtime="preceding-sibling::sound[1]/@time"/>kto<word
soundtime="preceding-sibling::sound[1]/@time"/>chto<word
soundtime="preceding-sibling::sound[1]/@time"/>gdje<word
soundtime="preceding-sibling::sound[1]/@time"/>kogda<word
soundtime="preceding-sibling::sound[1]/@time"/>kak<word
soundtime="preceding-sibling::sound[1]/@time"/>nje<word
soundtime="preceding-sibling::sound[1]/@time"/>vsje

--- Michael Kay <mike@xxxxxxxxxxxx> wrote:

> Looks like
> 
> <xsl:template match="clause">
>   <xsl:apply-templates select="word"/>
> </xsl:template>
> 
> <xsl:template match="word">
>   <word
> soundtime="preceding-sibling::sound[1]/@time"/>
>     <xsl:value-of select="."/>
>   </
> </
> 
> Michael Kay
> http://www.saxonica.com/ 
> 
> > -----Original Message-----
> > From: mark bordelon
> [mailto:markcbordelon@xxxxxxxxx] 
> > Sent: 30 January 2007 19:42
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject:  PARAMS and VARIABLES in XSL
> > 
> > I need help with the following problem.
> > 
> > This is the XML is wish to transform:
> >  
> > <clause>
> >  <sound time="1.2">
> >  <word>the</word>
> >  <word>quick</word>
> >  <sound time="2.2">
> >  <word>fox</word>
> >  <sound time="2.8">
> >  <word>jumped</word>
> > </clause>
> > <clause>
> > </clause>
> >  
> > I need to transform it into the following xml,
> where the 
> > sound tags time attritubes are soundtime
> attributes of the 
> > following word tags:
> >  
> > <clause>
> >  <word soundtime="1.2">the</word>
> >  <word soundtime="1.2">quick</word>
> >  <word soundtime="2.2">fox</word>
> >  <word soundtime="2.8">jumped</word>
> > </clause>
> > <clause>
> > </clause>
> >  
> > Note that the soundtime attribute should not
> change if there 
> > was no intervening new sound tag. 
> >  
> > I have tried all sorts of solutions using axes, 
> > preceding-sibling, but these did not work, since
> the <word> 
> > and <sound> are not true siblings to the
> processor, even 
> > though they are on the same level of the
> hierarchy.
> >  
> > The solution I would like to work with is the
> following, 
> > using params to accumulate the soundtime variable.
> However, 
> > even with all the research I have done, I cannot
> find a 
> > solution that the processor does not error on. Can
> anyone help?
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsl:stylesheet version="1.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
> 
> > <xsl:template match="//clause/*"> <xsl:param
> name="soundtime" 
> > /> <xsl:if test="local-name() = 'sound'">
> <xsl:param 
> > name="soundtime" select="@time" /> </xsl:if>
> <xsl:if 
> > test="local-name() = 'word'"> <word sound =
> "{$soundtime}" > 
> > <xsl:value-of select="." /> </word> </xsl:if>
> </xsl:template> 
> > </xsl:stylesheet>
> > 
> > 
> > 
> >  
> >
>
______________________________________________________________
> > ______________________
> > Cheap talk?
> > Check out Yahoo! Messenger's low PC-to-Phone call
> rates.
> > http://voice.yahoo.com
> 
> 



 
____________________________________________________________________________________
[expletive deleted]-punch spam with award-winning protection. 
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html

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.