I'm trying ot get a value from a splitted CSV variable and test it against a querystring value but keep getting this error with no description of the error
Error parsing XSLT file: \xslt\GalleryXSLT.xslt
Here is the code:
// value from querystring
<xsl:variable name="selectedTag" select="umbraco.library:RequestQueryString('tag')"/>
//the CSV values in a variable
<xsl:variable name="items" select="umbraco.library:Split($tagsFromNodes,',')" />
<xsl:for-each select="$items//value">
<xsl:if test="$selectedTag=current()"> //IT FAILS HERE
//Do something
</xsl:if>
<xsl:value-of select="umbraco.library:Replace(current(),' ',' ')"/>
</xsl:for-each>
If I reverse the test I get this error
<xsl:if test="current()=$selectedTag">
System.Xml.Xsl.XslTransformException: Attribute and namespace nodes cannot be added to the parent element after a text, comment, pi, or sub-element node has already been added.
I just looked at your code. When I try to save your XSLT file in a Umbraco 7 I get this error message.
System.Xml.Xsl.XslLoadException: The variable or parameter 'tagsFromNodes' is either not defined or it is out of scope. An error occurred at d:\web\localuser\dennisaaen.dk\umbraco\xslt\635254561292967509_temp.xslt(22,1).
at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
at System.Xml.Xsl.XslCompiledTransform.Load(XmlReader stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)
So I think at you are using the $tagsFromNodes variable before you have declared it.
Could you paste the entire stylesheet - or at least the contents of the <xsl:template> that surrounds your code - the errormessage you're getting is very much depending on the context, so will need to check that for what's going on.
Value from Split can't be used in if statement
I'm trying ot get a value from a splitted CSV variable and test it against a querystring value but keep getting this error with no description of the error
Error parsing XSLT file: \xslt\GalleryXSLT.xslt
Here is the code:
If I reverse the test I get this error
System.Xml.Xsl.XslTransformException: Attribute and namespace nodes cannot be added to the parent element after a text, comment, pi, or sub-element node has already been added.
Any ideas what I am doing wrong?
Thanks.
DT
FYI, I'm on Umbraco 7
Hi Duc,
I just looked at your code. When I try to save your XSLT file in a Umbraco 7 I get this error message.
So I think at you are using the $tagsFromNodes variable before you have declared it.
Hope this can help you further.
/Dennis
Hi Duc,
Could you paste the entire stylesheet - or at least the contents of the
<xsl:template>
that surrounds your code - the errormessage you're getting is very much depending on the context, so will need to check that for what's going on./Chriztian
Thanks for the reply. After copying the code here to share, I checked it again and then realised it was a coding error.
My question is no longer valid.
is working on a reply...