Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Andres Tenjo 35 posts 55 karma points
    Mar 19, 2011 @ 19:38
    Andres Tenjo
    0

    Error parsing the XSLT for attribute name="value"

    I'm trying to put this attribute: 

    <input type="radio" name="quiz"/>

       <xsl:attribute name="value"><xsl:value-of select="data[@id]" />

       </xsl:attribute>

     

    Save ok , but to run apperear: Error parsing the XSLT for attribute name="value" 

    What can I do ??

  • rorythecheese 110 posts 56 karma points
    Mar 19, 2011 @ 20:40
    rorythecheese
    0

    It looks like it's not working because the <input> is a closed tag. The xsl:attribute only works when declared within a element's open and closing tags. 

    I think the only way is to add the data[@id] within the input tag like this

    <input type="radio" name="quiz" value="{data[@id]}"/>

     

  • Kim Andersen 1447 posts 2196 karma points MVP
    Mar 19, 2011 @ 21:36
    Kim Andersen
    0

    Hi Andres

    Either you can do like Rory says, I'd probably do that, but you can use the xsl:attribute like this if you prefer that:

    <input type="radio" name="quiz"> 
    <xsl:attribute name="value">
    <xsl:value-of select="data[@id]" />  
    </xsl:attribute>
    </input>

    /Kim A

  • Andres Tenjo 35 posts 55 karma points
    Mar 20, 2011 @ 06:29
    Andres Tenjo
    0

    sorry doesn't work whitn any of yours answers :( 

     

  • Kim Andersen 1447 posts 2196 karma points MVP
    Mar 20, 2011 @ 08:41
    Kim Andersen
    0

    Hi Andres

    What are you trying to put inside of the value attribute? Is it something from the Umbraco XML, or your own generated XML?

    Could you show us your whole XSLT?

    /Kim A

  • Andres Tenjo 35 posts 55 karma points
    Mar 20, 2011 @ 15:07
    Andres Tenjo
    0

    <input type="radio" name="quiz"/>

        <xsl:attribute name="value"><xsl:value-of select="data[@id]" />

        </xsl:attribute>

    I have to use xml ? 

     

  • Kim Andersen 1447 posts 2196 karma points MVP
    Mar 20, 2011 @ 20:14
    Kim Andersen
    0

    Andres, the code that you just postet, is the exact same as the first piece of code you posted. Can you please post all of your code in here?

    And yes, you have to use XML, as XSLT are used to transform XML to HTML. What are you trying to put inside the value attribute?

    /Kim A

  • Srdjan Lukic 34 posts 166 karma points
    Mar 20, 2011 @ 21:29
    Srdjan Lukic
    0

    Andres, I'm sure your problem will be solved if you used Kim Andersens code. Your input field is closed and there for you can't att any attributes to it. You need to remove the />  and add </input> after your attribut call. 

  • Andres Tenjo 35 posts 55 karma points
    Mar 20, 2011 @ 22:26
    Andres Tenjo
    0

    <xsl:if test="count($nodes)">

    <p class="textRadioList"><input type="radio" name="quiz" value="{data[@id]}" >

    <xsl:attribute name="value"><xsl:value-of select="data[@id]" />

       </xsl:attribute>

    &nbsp;<xsl:value-of select="./data [@alias='quiz_op_name']"/>

    </input>

     

    </p>

    </xsl:if>

    Sorry guys but the problem persist...

     

     

  • Srdjan Lukic 34 posts 166 karma points
    Mar 20, 2011 @ 22:39
    Srdjan Lukic
    0

    Try with  : 

     

     

     

    <xsl:if test="count($nodes)">
    <p class="textRadioList">
    <input type="radio" name="quiz" >
    <xsl:attribute name="value"><xsl:value-of select="data[@id]" /> </xsl:attribute>

    </input>

    </p> </xsl:if>

     

     

  • Srdjan Lukic 34 posts 166 karma points
    Mar 20, 2011 @ 22:40
    Srdjan Lukic
    0

    Oops was a bit to quick 

    <xsl:if test="count($nodes)">
    <p class="textRadioList">
    <input type="radio" name="quiz" >
    <xsl:attribute name="value"><xsl:value-of select="data[@id]" /> </xsl:attribute>

    </input>

    &nbsp;<xsl:value-of select="./data [@alias='quiz_op_name']"/>

    </p> </xsl:if>

  • Andres Tenjo 35 posts 55 karma points
    Mar 21, 2011 @ 02:23
    Andres Tenjo
    0

    not yet , it seems that the node name by calling the property attribute it works
    but strangely the with the id is impossible to do?

    <xsl:if test="count($nodes)">

    <p class="textRadioList"><input type="radio" name="quiz" >

    <xsl:attribute name="value"><xsl:value-of select="./data [@alias='quiz_op_name']" /> </xsl:attribute>

    </input>

    &nbsp;<xsl:value-of select="./data [@alias='quiz_op_name']"/>

    </p>

    </xsl:if>

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Mar 21, 2011 @ 07:50
    Jan Skovgaard
    0

    Hi Andres

    What kind of error message do you get when trying to save the XSLT file?

    /Jan

  • Kim Andersen 1447 posts 2196 karma points MVP
    Mar 21, 2011 @ 08:31
    Kim Andersen
    0

    Andres, are you inside a loop here? It could look like that when you use the "."-selector.

    Besides that, which version of Umbraco are you using?

    If you are using one of the newer versione of Umbraco you probably need to change this:

    <xsl:value-of select="./data [@alias='quiz_op_name']" />

    to this:

    <xsl:value-of select="./quiz_op_name" />

    That, though, requires that you are inside a loop when using the "."-seelctor (current). If you want to grab it from the current page you need to use $currentPage instead of the ".".

    And another thing. When you say the problem's still there, do you then mean that there's an XSLT parsing error, or that the value-attribute is just empty?

    /Kim A

  • Andres Tenjo 35 posts 55 karma points
    Mar 22, 2011 @ 20:44
    Andres Tenjo
    0

    I have to call this obligatory:

       <xsl:attribute name="value"><xsl:value-of select="data[@id]" />

       </xsl:attribute>

    But it doesn't work

    Someone have an idea ????

     

    Kim,

    I'm using  4.0.4.2 version, then I have to use

    "./data [@alias='quiz_op_name']"
  • Andres Tenjo 35 posts 55 karma points
    Mar 22, 2011 @ 20:52
    Andres Tenjo
    0

    And now using <xsl:attribute name="value"><xsl:value-of select="data[@id]" /></xsl:attribute>  don't show any error, but in the front-end value attribute is null

     

  • Kim Andersen 1447 posts 2196 karma points MVP
    Mar 22, 2011 @ 20:53
    Kim Andersen
    0

    Yeah, then you are grabbing the quiz_op_name the right way.

    But you still haven't told us if you're inside a loop. Let's say that you are inside a loop, and want to add the id of the current node that's being itereated through. Then you must change this:

    <xsl:value-of select="data[@id]" />

    to this:

    <xsl:value-of select="./@id" />

    It would still be a lot easier if you showed us the whole xslt, instead of just a snippet though.

    /Kim A

  • Andres Tenjo 35 posts 55 karma points
    Mar 22, 2011 @ 21:23
    Andres Tenjo
    0

    Ok Finally It works ! <xsl:attribute name="value"> <xsl:value-of select="@id" /></xsl:attribute>

    Thanks for all !

     

  • Kim Andersen 1447 posts 2196 karma points MVP
    Mar 22, 2011 @ 21:51
    Kim Andersen
    0

    Great that we finally solved this Andres. I think we could have fixed this a lot faster if we knew that we where inside a loop, and "only" trying to output the id of the node that was currently itereted through. But then again, now things work, so everyone is happy :)

    /Kim A

  • Andres Tenjo 35 posts 55 karma points
    Mar 23, 2011 @ 01:18
    Andres Tenjo
    0

    thanks , but now the problem is in a webservice to call this @id :P

Please Sign in or register to post replies

Write your reply to:

Draft