It's hard to know until you've tried it, but you need to convert an XML variable into a node-set to be able to query it with XPath - it's easy to do. Here's a full sample.
System.Xml.Xsl.XslLoadException: Prefix 'make' is not defined. An error occurred at C:\inetpub\wwwroot\localhost\xslt\634568945636893025_temp.xslt(16,3). at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver) at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)
- The reason for the "Prefix 'make' is not defined" error would be because you forgot to add the xmlns:make="...." just above the exclude-result-prefixes="..." line.
- The default Umbraco templates adds this namespace with the prefix msxml instead - I just like make better because the function call makes more sense to me :-) The crucial part of using namespaces is the actual namespace-URI (urn:schemas-microsoft-com:xslt).
Need help parsing an array in a for-each loop
I have the following
<xsl:variable name="Categories">
<Category Item="A" />
<Category Item="B" />
<Category Item="C" />
<Category Item="D" />
<Category Item="D" />
</xsl:variable>
I will like to use it in the following by concatenating the curent category in the for-each loop to an attribute in order to
get the value of that attribute
<xsl:for-each select="Categories">
<tr class="odd">
<td align="left" style="height:48px;">
<xsl:value-of select="umbraco.library:ReplaceLineBreaks($currentPage/* [@alias = concat('Dept', @Item)])" disable-output-escaping="yes"/>
</td>
....
</tr>
</xsl:for-each>
...
The issue I am seeing is it is not even transversing the loop
Please help
Hi Paul,
It's hard to know until you've tried it, but you need to convert an XML variable into a node-set to be able to query it with XPath - it's easy to do. Here's a full sample.
Note that I've changed the reference to @alias - if you're actually using the old XML schema you can change it back.
/Chriztian
I receive the following exception even after add "umb make" to the exclude-result-prefixes section.Just as shown.
exclude-result-prefixes="msxml umb make umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary umb make">
The error I receive is:
System.Xml.Xsl.XslLoadException: Prefix 'make' is not defined. An error occurred at C:\inetpub\wwwroot\localhost\xslt\634568945636893025_temp.xslt(16,3).
at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)
By replacing make with msxml and replacing a call to the function ReplaceLineBreaks by GetMdia for an image file. It worked!
Thanks a billion!
Hi Paul,
Just to clarify:
- The reason for the "Prefix 'make' is not defined" error would be because you forgot to add the xmlns:make="...." just above the exclude-result-prefixes="..." line.
- The default Umbraco templates adds this namespace with the prefix msxml instead - I just like make better because the function call makes more sense to me :-) The crucial part of using namespaces is the actual namespace-URI (urn:schemas-microsoft-com:xslt).
/Chriztian
is working on a reply...