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
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.
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?
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
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.
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 :)
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 ??
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
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:
/Kim A
sorry doesn't work whitn any of yours answers :(
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
<input type="radio" name="quiz"/>
<xsl:attribute name="value"><xsl:value-of select="data[@id]" />
</xsl:attribute>
I have to use xml ?
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
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.
<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>
<xsl:value-of select="./data [@alias='quiz_op_name']"/>
</input>
</p>
</xsl:if>
Sorry guys but the problem persist...
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>
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>
<xsl:value-of select="./data [@alias='quiz_op_name']"/>
</p> </xsl:if>
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>
<xsl:value-of select="./data [@alias='quiz_op_name']"/>
</p>
</xsl:if>
Hi Andres
What kind of error message do you get when trying to save the XSLT file?
/Jan
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
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']"
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
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:
to this:
It would still be a lot easier if you showed us the whole xslt, instead of just a snippet though.
/Kim A
Ok Finally It works ! <xsl:attribute name="value"> <xsl:value-of select="@id" /></xsl:attribute>
Thanks for all !
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
thanks , but now the problem is in a webservice to call this @id :P
is working on a reply...