XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 23rd, 2004, 06:26 AM
orjan orjan is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 3 orjan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 45 sec
Reputation Power: 0
xsl:value-of select with $varibles

I have problem with returning the value from a specific element from a varible and I would like som help. This is my xslt:
Code:
my variable model:
    <model xmlns = "http://www.w3.org/2002/xforms">
    <instance>
        <ecommerce>
            <method />
            <number>190</number>
....

<xsl:template match="input">
    <input type="text" id="{@ref}" name="{@ref}" 
    // Problem row !!!
    value="<xsl:value-of select="$model/model/instance//{@ref}"/>"
    />
</xsl:template>


I would like to get the value from $model/model/instance/ any element matching {@ref} but I don't know how to write it.

edit 1:
If I'm writing
Code:
  
value="<xsl:value-of select="$model"/>"

I'll get value="190" for all elements

edit 2:
I have tried to move the varible into the orignal xml-file but it doesn't work either. I think there might be a problem with the xpath expression and the dynamic @ref. Is there a workaround for the problem?

Best Regards,

Örjan

Reply With Quote
  #2  
Old September 24th, 2004, 11:38 AM
t_subramanian80 t_subramanian80 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 7 t_subramanian80 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up i hope your problem solved

<xsl:template match="input">
<xsl:variable name="AttValue"><xsl:value-of select="$model/model/instance//{@ref}"/></xsl:variable>
<input type="text" id="{@ref}" name="{@ref}" >
<xsl:attribute name="value">
<xsl:value-of select="$AttValue"/>
</xsl:attribute>
</input>
</xsl:template>

Reply With Quote
  #3  
Old September 27th, 2004, 06:09 AM
orjan orjan is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 3 orjan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 45 sec
Reputation Power: 0
I'm afraid it doesn't work and I think it depends on that xpath 1.0 cannot take dynamic expressions like {@ref}.

My problem is that I would like to transform a xform document to xhtml but since it's not possible to parse to branches a the same time eg. model&control it's hard if not impossible to make the transformation with xslt. I'm curious if you have any other ideas of transforming xforms to xhtml.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > xsl:value-of select with $varibles


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT