I have a document type (thm_new) which has the "tags" datatype (thm_new_tags) in it. I don't know why I can't access each individual type in the typical <xsl:for-each>...
I mean... if for every new I select "thm_new_tags" I can show them... but as a group. As I want to show each of the tags with a link I have tried several things as "thm_new/thm_new_tags/tag" and "thm_new/thm_new_tags/tags_tag" (just in case...). As I think the path once inside "thm_new/thm_new_tags" depends on how the "tags" datatype is created (by Umbraco)... how can I know the exact path to access each tag of each new?
Many "tags" words... I know, hope you understand. I'll clarify if it's confusing ;).
the tags datatype basically stores a comma separated list of the tag words (not the id of the tag in the database), e.g. 'tag1,tag2,tag3'. You should be able to easily loop through them like
However you might also want to look at the umbraco.editorControls.tags.library features, a good first starting point is: http://www.blogfodder.co.uk/2009/12/22/using-tags-in-umbraco. You should be able to do everything you need to do with the tags library.
Thanks a lot Sascha, you're always saving me! Haha!
It worked with your snippet... I had no idea it was a comma-separated list. One thing I'm finding hard with Umbraco is... where do I get to know this kind of info? If you could point me to any place that has this sort of things organized I'll be very very glad as I find myself lots of times asking things just because I don't know how exactly Umbraco has this or that thing implemented...
Anyway... I now have what I needed. About the article, it basically relates what it is in a video on umbraco.tv, one on the datatypes part. I did try to use the tags library, but the problem I think it was more or less the same... I wasn't expecting it to return a comma-separated list.
Many many thanks. I don't know how my site would be at this stage without the people from here =). Cheers!
glad you got it working. :) A good place to start when you are looking how Umbraco holds the data is the /App_Code/umbraco.config file which contains an XML representation of all your nodes. There you can easily see what's happening and how data is stored. With an application like XmlSpy (there are probably free ones out there as well, maybe even VS can apply xpath expressions?) you can even perform xpath expressions on it and see what is happening, very handy!
Another trick is to debug your xslt by outputting the data in the variables in a textarea field by using the xsl:copy-of function instead of value-of (copy-of leaves the XML structure intact), so you can easily see what is actually contained in the property you're dealing with:
Access each individual tag
Hello!
I have a document type (thm_new) which has the "tags" datatype (thm_new_tags) in it. I don't know why I can't access each individual type in the typical <xsl:for-each>...
I mean... if for every new I select "thm_new_tags" I can show them... but as a group. As I want to show each of the tags with a link I have tried several things as "thm_new/thm_new_tags/tag" and "thm_new/thm_new_tags/tags_tag" (just in case...). As I think the path once inside "thm_new/thm_new_tags" depends on how the "tags" datatype is created (by Umbraco)... how can I know the exact path to access each tag of each new?
Many "tags" words... I know, hope you understand. I'll clarify if it's confusing ;).
Thanks for everything!
Hi Jacobo,
the tags datatype basically stores a comma separated list of the tag words (not the id of the tag in the database), e.g. 'tag1,tag2,tag3'. You should be able to easily loop through them like
<xsl:for-each select="Exslt.ExsltStrings:split($thm_new_tags, ',')">
<xsl:value-of select="." />
</xsl:for-each>
However you might also want to look at the umbraco.editorControls.tags.library features, a good first starting point is:
http://www.blogfodder.co.uk/2009/12/22/using-tags-in-umbraco.
You should be able to do everything you need to do with the tags library.
Hope that helps,
Sascha
Hello!
Thanks a lot Sascha, you're always saving me! Haha!
It worked with your snippet... I had no idea it was a comma-separated list. One thing I'm finding hard with Umbraco is... where do I get to know this kind of info? If you could point me to any place that has this sort of things organized I'll be very very glad as I find myself lots of times asking things just because I don't know how exactly Umbraco has this or that thing implemented...
Anyway... I now have what I needed. About the article, it basically relates what it is in a video on umbraco.tv, one on the datatypes part. I did try to use the tags library, but the problem I think it was more or less the same... I wasn't expecting it to return a comma-separated list.
Many many thanks. I don't know how my site would be at this stage without the people from here =). Cheers!
Hi Jacobo,
glad you got it working. :) A good place to start when you are looking how Umbraco holds the data is the /App_Code/umbraco.config file which contains an XML representation of all your nodes. There you can easily see what's happening and how data is stored. With an application like XmlSpy (there are probably free ones out there as well, maybe even VS can apply xpath expressions?) you can even perform xpath expressions on it and see what is happening, very handy!
Another trick is to debug your xslt by outputting the data in the variables in a textarea field by using the xsl:copy-of function instead of value-of (copy-of leaves the XML structure intact), so you can easily see what is actually contained in the property you're dealing with:
Cheers,
Sascha
Thanks Sascha, I will have a look at all that... It can be very very handy!
Thanks a lot for everything.
is working on a reply...