i am working in umbraco for the just past 1 weak. I really want to master the XSLT. I would like to get all the possible nodes that is present in the XML schema of umrbaco. Does any one can help me on how to get all the possible values present in the XML schema
Those are great suggestions by Dan. If you just want to see the XML from a certain page that you stand on, and all of the pages' underlying nodes, you can use the good old textarea trick like this:
Well, that's great that you'll use the classic textarea trick. I still use it when I want to see what's inside of variables, the current page, the selected nodes etc. But you should be able to use the XML Dump package as well though. Depending on which version of Umbraco you are running :)
I used to used the textarea thing like Kim but when wokring on xslt for things like top navigation on a site I didnt want to see a big textarea breaking the styling of my site.
For debugging I use a combination of Firefox and Firebug. Then add this to the xslt:
I think it's better you avoid having all the XML output in the source. Even though it's not being displayed it's in your markup and that does not make any sense at all and it can add to the documents weight depending on how much XML is in your selection.
Instead I sugest you use this very comon approach shown below where you use a querystring parameter so you can easily see the XML content if you need to debug something.
Then the XML only gets printed if you add debug=1 (the value can be anything, it just needs to contain something) to the url of the page you are working on. For instance
I like your use of the Request I hadn't thought of that. That would be useful when developing on a live site possibly.
The reason I output the xml into a hidden div is because it saves me copying the xml from the textarea and saving it as an xml just to make it easy to read. Basically just so I can collapse and expand the xml to view the nodes.
For debuggin purposes ONLY I find it much easier to view the xml in a div with firebug. I don't leave the xml in the source when the xslt is working.
I tend do output the complete xml using an alternative template, which you can use on any page, wherever in the content tree. For example, let's assume you've created a template getXml (no need for master templates here), add a single macro that refers to an xslt file. In that file, just add a single statement
Actually the XML Dump package should work with v4.5 as well. As described on the project page:
"UPDATE: There's an alternate XSLT file for use with
the new 4.5 XML Schema. Just download the file and paste its contents
into the 'XMLDump.xslt' file (or create it as a separate XSLT and point
the macro to the new file). Grab it here (or below): greystate.dk/.../xmldump-41b2.xslt"
So you might want to try out that file instead. If you still want to use the package of course :)
Complete XML schema of umbraco
Hi
i am working in umbraco for the just past 1 weak. I really want to master the XSLT. I would like to get all the possible nodes that is present in the XML schema of umrbaco. Does any one can help me on how to get all the possible values present in the XML schema
Thanks in advance
Hi,
Welcome to our.umbraco! You can find an XML cache of the published website content (which is used in your XSLT macros) under data > umbraco.config.
Chriztian Steinmeier's XML Dump package might also be of use?
Those are great suggestions by Dan. If you just want to see the XML from a certain page that you stand on, and all of the pages' underlying nodes, you can use the good old textarea trick like this:
This will give the entire XML from the current page.
/Kim A
Hi Kim
That's great. XML dump doesn't seems to be working for me. i don't see any nodes
Well, that's great that you'll use the classic textarea trick. I still use it when I want to see what's inside of variables, the current page, the selected nodes etc. But you should be able to use the XML Dump package as well though. Depending on which version of Umbraco you are running :)
/Kim A
I used to used the textarea thing like Kim but when wokring on xslt for things like top navigation on a site I didnt want to see a big textarea breaking the styling of my site.
For debugging I use a combination of Firefox and Firebug. Then add this to the xslt:
And since I'm using Firebug to look at the source of the page it makes looking at the xml output easier.
Ben
Hi Ben
I think it's better you avoid having all the XML output in the source. Even though it's not being displayed it's in your markup and that does not make any sense at all and it can add to the documents weight depending on how much XML is in your selection.
Instead I sugest you use this very comon approach shown below where you use a querystring parameter so you can easily see the XML content if you need to debug something.
<xsl:if test="umbraco.library:Request('debug')">
<textarea>
<xsl:copy-of select="$currentPage" />
</textarea>
</xsl:if>
Then the XML only gets printed if you add debug=1 (the value can be anything, it just needs to contain something) to the url of the page you are working on. For instance
When normal users visit the site they go to http://mysite.com/news/newsitem.aspx and when you need to debug you go to the same site and add the querstring parameter like this: http://mysite.com/news/newsitem.aspx?debug=1
Just my 2 cents
/Jan
Hi Jan,
I like your use of the Request I hadn't thought of that. That would be useful when developing on a live site possibly.
The reason I output the xml into a hidden div is because it saves me copying the xml from the textarea and saving it as an xml just to make it easy to read. Basically just so I can collapse and expand the xml to view the nodes.
For debuggin purposes ONLY I find it much easier to view the xml in a div with firebug. I don't leave the xml in the source when the xslt is working.
Ben
Hi Ben
Ah ok - yes in that case I can see what you mean. Then it makes sense :-)
/Jan
I tend do output the complete xml using an alternative template, which you can use on any page, wherever in the content tree. For example, let's assume you've created a template getXml (no need for master templates here), add a single macro that refers to an xslt file. In that file, just add a single statement
If you have a page in the content tree called http://www.domain.com/my-page(.aspx), then just use http://www.domain.com/my-page/getxml(.aspx) and let your browser take care of the xml representation.
I sometimes even use this on live sites if I don't want or can access the server to get the umbraco.config file.
Hope this helps.
Regards,
/Dirk
hi kim
you are absolutely right. I am using umbraco 4.5
@Nagarajan:
Actually the XML Dump package should work with v4.5 as well. As described on the project page:
"UPDATE: There's an alternate XSLT file for use with the new 4.5 XML Schema. Just download the file and paste its contents into the 'XMLDump.xslt' file (or create it as a separate XSLT and point the macro to the new file). Grab it here (or below): greystate.dk/.../xmldump-41b2.xslt"
So you might want to try out that file instead. If you still want to use the package of course :)
/Kim A
is working on a reply...