This works fine. I'd like to add $currentPage/@nodeName into the 'lines' variable. In other words, combine/merge the data. Lets assume the @nodeName value is 'Page'. I would want the output to look like this:
This however does not output the data as desired. The following is the output:
<li>Pagevalue1<li>
It seems to have merged @nodeName with the first value of the textbox multiple. This produced a single merged value instead of 5 unique combined values.
Hoping someone might help point me in the right direction. Please and thank you.
I came up with the following last night. This script uses the true doctype aliases and date formatting. It's not pretty but it seems to work.
<xsl:variable name="pre">
<xsl:value-of select="$currentPage/data[@alias='eventDate']"/><xsl:text>
</xsl:text>
</xsl:variable>
// add linebreak to datepicker data
<xsl:variable name="addtime" select="umbraco.library:Replace($currentPage/data[@alias='additionalDates'], '
', 'T00:00:00
')"/>
// replace all linebreaks with date formatting and re-add linebreak at end
<xsl:variable name="finaltime">
<xsl:value-of select="$addtime"/><xsl:text>T00:00:00</xsl:text>
</xsl:variable>
// adds a linebreak to the end (final line has none)
<xsl:variable name="lines">
<xsl:value-of select="$pre"/>
<xsl:value-of select="$finaltime"/>
</xsl:variable>
// merges the data
<xsl:variable name="merged" select="umbraco.library:Split($lines, '
')//value"/>
// splits the merged data data into array
<xsl:for-each select="$merged">
<li><xsl:value-of select="current()/text()"/></li>
</xsl:for-each>
// loops data into a list
eventDate is an Umbraco datepicker which outputs the date like this: 2016-11-11T00:00:00. The textbox multiple allows the user to input additional dates in this format: 2016-11-11. The script above reads the text multiple, adds the "T00:00:00" and inserts the linebreak back.
Then splits the lines based on 
 and builds a variable, then finally merges with eventDate. The final output is:
Combine/merge data in XSLT variable
The scenario: $currentPage has a textbox multple datatype with the following data:
The textbox multpile has an alias of 'theValues' with 4 lines of data. I use the following XSLT to extract this data and print to a list:
This works fine. I'd like to add $currentPage/@nodeName into the 'lines' variable. In other words, combine/merge the data. Lets assume the @nodeName value is 'Page'. I would want the output to look like this:
I have tried the following after searching for examples of merging data in an XSLT variable:
This however does not output the data as desired. The following is the output:
It seems to have merged @nodeName with the first value of the textbox multiple. This produced a single merged value instead of 5 unique combined values.
Hoping someone might help point me in the right direction. Please and thank you.
Hi,
It's been ages (and I don't have anything handy to test this with).. but something like:
Just concatenating on the page name at the start of the list?
HTH
Steve
I came up with the following last night. This script uses the true doctype aliases and date formatting. It's not pretty but it seems to work.
eventDate is an Umbraco datepicker which outputs the date like this: 2016-11-11T00:00:00. The textbox multiple allows the user to input additional dates in this format: 2016-11-11. The script above reads the text multiple, adds the "T00:00:00" and inserts the linebreak back.
Then splits the lines based on 
 and builds a variable, then finally merges with eventDate. The final output is:
No doubt there might have been a better way.
is working on a reply...