Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I'm having a conceptual block which I'm hoping someone may be able to help me with.
I have an sxlt select as follows:
<xsl:for-each select="$currentPage/rightHandImage/DAMP[@fullMedia]/mediaItem/Image">
What I'm trying to do is re-use a macro so that I can substitute the rightHandImage with a number of variables to place images on the page.
If I pass rightHandImages through as a variable then I get a unexpected character error in XSLT as follows:
<xsl:for-each select="$currentPage/$imageLocation/DAMP[@fullMedia]/mediaItem/Image">
How should I be preparing my select so that it selects 2 variables?
Thanks in advance.
You can achieve this like so:
<xsl:for-each select="$currentPage/* [not(@isDoc)][local-name() = $imageLocation]/DAMP[@fullMedia]/mediaItem/Image">
assuming $imageLocation is a string with the alias of the field you are looking for
Hope this helps,Tom
Hi Tom,
Thanks for the code, this works perfectly. I am assuming tha the * [not(@isDoc)]etc means that I'm telling XSLT that the field I'm trying to collect is not part of the default document rather part of the custom element?
Thanks again.
Exactly. The isDoc attribute appears in the schema on all Document Type nodes to indicate it's a document. Custom properties don't have it. Ex:
<NewsArea id="1053" ..... isDoc=""> <pageHeadline>...</pageHeadline> <bodyText>..</bodyText> <NewsItem id="1054" .... isDoc=""> <newsDate>...</newsDate> </NewsItem></NewsArea >
So to make sure you only retrieve properties in your select statement, you add not(@isDoc)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Multiple parameters in xlst select
Hi,
I'm having a conceptual block which I'm hoping someone may be able to help me with.
I have an sxlt select as follows:
<xsl:for-each select="$currentPage/rightHandImage/DAMP[@fullMedia]/mediaItem/Image">
What I'm trying to do is re-use a macro so that I can substitute the rightHandImage with a number of variables to place images on the page.
If I pass rightHandImages through as a variable then I get a unexpected character error in XSLT as follows:
<xsl:for-each select="$currentPage/$imageLocation/DAMP[@fullMedia]/mediaItem/Image">
How should I be preparing my select so that it selects 2 variables?
Thanks in advance.
Hi,
You can achieve this like so:
assuming $imageLocation is a string with the alias of the field you are looking for
Hope this helps,
Tom
Hi Tom,
Thanks for the code, this works perfectly. I am assuming tha the * [not(@isDoc)]etc means that I'm telling XSLT that the field I'm trying to collect is not part of the default document rather part of the custom element?
Thanks again.
Exactly. The isDoc attribute appears in the schema on all Document Type nodes to indicate it's a document. Custom properties don't have it. Ex:
<NewsArea id="1053" ..... isDoc="">
<pageHeadline>...</pageHeadline>
<bodyText>..</bodyText>
<NewsItem id="1054" .... isDoc="">
<newsDate>...</newsDate>
</NewsItem>
</NewsArea >
So to make sure you only retrieve properties in your select statement, you add not(@isDoc)
is working on a reply...