I know that if you don't pass a valid ID into umbraco.library:GetXmlNodeById(), it will just return the content of your entire text stored in the XML structure.
You'd want to test the output of $DataPage without the /@nodeName.
[code][/code]
I don't really know why your NiceUrl returns the result with a queryString though. I thought the NiceURL method builds your url and adds the ".aspx" to the end.
Your code for creating the DataPage variable is missing a context when you try to get an id from the /data subnode.
Working with xslt in Umbraco is a bit unusual in that there is no default context, so in the following code:
The /data[@alias='sourceNode'] will not return anything since there is no context for the /data part. In other words the xslt parser have no idea what /data node to look for since you haven't specified the parent node for /data.
The only way to "jump into" a xslt context in umbraco xslt is through the $currentPage parameter, which will place you on a node in the middle of the content xml for the umbraco front end.
If your id is stored in a property called sourcenode on the current page where the xslt is used you can get to the data with this code.
Notice that in this example I've created the variable after the currentPage param, since this needs to be declared before you access it in the variable declaration.
PickUPNode : returning URL and NodeName
Hi,
I wrote an XSLT macro:
[code]
]>
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"
exclude-result-prefixes="msxml umbraco.library">
[/code]
for reading bodyText and for having URL and NodeName.
All is ok, but
[code] [/code]
give me empty string. Why?
Second:
Why Had I as result from [code]{umbraco.library:NiceUrl($currentPage/data[@alias='sourceNode'])}[/code]
http://www.atrigna-tour-n-service.it/news/ponte-2-giugno-ventaglio-calabria.aspx?umbNl=1805 and NOT http://www.atrigna-tour-n-service.it/news/ponte-2-giugno-ventaglio-calabria.aspx
Why Umbraco append ID node?
Thanks
I know that if you don't pass a valid ID into umbraco.library:GetXmlNodeById(), it will just return the content of your entire text stored in the XML structure.
You'd want to test the output of $DataPage without the /@nodeName.
[code][/code]
I don't really know why your NiceUrl returns the result with a queryString though. I thought the NiceURL method builds your url and adds the ".aspx" to the end.
NiceUrl return link, but add ?umbNl=1805...why???
I haven't had that problem before. Sorry mate.
Ah... MayBe AGV Antivirus Plugin that control link ...
Actually I think you have another problem:
Your code for creating the DataPage variable is missing a context when you try to get an id from the /data subnode.
Working with xslt in Umbraco is a bit unusual in that there is no default context, so in the following code:
The /data[@alias='sourceNode'] will not return anything since there is no context for the /data part. In other words the xslt parser have no idea what /data node to look for since you haven't specified the parent node for /data.
The only way to "jump into" a xslt context in umbraco xslt is through the $currentPage parameter, which will place you on a node in the middle of the content xml for the umbraco front end.
If your id is stored in a property called sourcenode on the current page where the xslt is used you can get to the data with this code.
Notice that in this example I've created the variable after the currentPage param, since this needs to be declared before you access it in the variable declaration.
Regards
.Hauge
Argh - this forum editor can't be trusted ATM :( I hope the powers that be will fix it real soon.
.Hauge
Argh this editor is very brittle.
In short: Replace this code
With this
To get DataPage to contain the node referenced by the id stored in the sourceNode property of the current page.
Read around the text with weird tags above to get a longer explanation.
.Hauge
is working on a reply...