You are welcome maanehunden. I think the new XML schema is great. It rocks. I love it :)
But in the beginning it can maybe be a little confusing and of course it takes some time learning a new schema. A good way of learning how to work with the new schema, is to see how the XML is build. You can do this in a couple of ways. The old school way of doing it is printing the XML out in a textarea like this:
Umbraco 4.5.2 - returns emty string when quering @nodeTypeAlias
I've puzzled by this error i've spend a couple of days trying to figure this one out. Some how i can't get my xslt to return a nodes @nodeTypeAlias.
I've created my doctype as i allays do,.. http://img811.imageshack.us/i/screenshot004r.jpg/ her's my content tree http://img98.imageshack.us/i/screenshot005g0.jpg/ ;
and the code,..
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="home" select="umbraco.library:GetXmlAll()/node[@nodeTypeAlias ='ffHome']"></xsl:variable>
<xsl:variable name="home1" select="umbraco.library:GetXmlAll()/node[@nodeTypeAlias ='RunwayHomepage']"/>
<xsl:variable name="levelOneNode" select="$currentPage/ancestor-or-self::node[@nodeTypeAlias ='ffHome']"/>
<xsl:template match="/">
<!-- start writing XSLT -->
<div style="border:solid 1px red; color:white;">
[<xsl:value-of select="$currentPage/@nodeTypeAlias "/>]
[<xsl:value-of select="$home/@nodeTypeAlias"/>]
[<xsl:value-of select="$home1/@nodeTypeAlias"/>]
</div>
</xsl:template>
</xsl:stylesheet>
Some how they all came out empty,.. ?? Just doesn't make any sense to me ,..
any suggestions..
In the new XML schema the nodeTypeAlias is now the name of the nodes. Means that you code must be changed to this:
I'm pretty sure this will work for you.
/Kim A
brilliant,. thanks Kim, a bit disappointed thou about them changing the XML schema that way,.. but hay ,.. more fun to be learned ,.. I've found this article about this subject ,.. i don't know how it eluded me but her it is http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/no-more-@nodetypealias,.. and http://our.umbraco.org/wiki/reference/xslt/45-xml-schema
http://our.umbraco.org/wiki/reference/xslt/recursive-menu-umbraco-45
Hope it can help some one,..
Btw,.. could be fun to see more examples,..
Hi,
If you have 4.5.2 install you can see more examples by selecting a template when you create a new xslt file.
Rich
You are welcome maanehunden. I think the new XML schema is great. It rocks. I love it :)
But in the beginning it can maybe be a little confusing and of course it takes some time learning a new schema. A good way of learning how to work with the new schema, is to see how the XML is build. You can do this in a couple of ways. The old school way of doing it is printing the XML out in a textarea like this:
This will give you the XML of the current page. You can do this with all the stuff that you want, like e.g. the result of an extension like this:
Another approach is to use Chriztian Steinmeir's package called XML Dump. You can find it right here.
/Kim A
thx .. Rich and Kim A, some good tips there,. i especially like the textarea "hack",.. i am going to be using that a'lot (c:
is working on a reply...