Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsOther Extension...Other Extension...Need XSL to split a string from XML inputNeed XSL to split a string from XML input
Previous
 
Next
New Post
3/16/2010 8:48 AM
 

XSL:

I need to read the string from XML and split using the delimiter "|" and concatenate the text with the URL until the maximum count of the split () array. I have given my XML input format and output in XML (see below). I have tried with str: split function in XSLT but it’s not supporting in XSL.

 

XML input:

<Tag>

text1|url1|text2|url2…..

</Tag>

 

My Output Should be:

Hyperlink URL; Hyperlink2;

So when I click text1 it should navigate to url1

 

PLEASE HELP ME!!


Thanks, Jasper Paul
 
New Post
3/18/2010 3:19 AM
 

XML file name is XMLXSL.xml and the content is

<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="XSLTFile.xsl"?>
<HeaderTag>
yahoo|http://www.yahoo.com|google|http://www.google.com
</HeaderTag>

XSL file name is XSLTFile.xsl and content is:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:call-template name="output">
<xsl:with-param name="list" select="HeaderTag"></xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="output">
<xsl:param name="list" />
<xsl:variable name="newlist" select="concat(normalize-space($list), '|')" />
<xsl:variable name="first" select="substring-before($newlist, '|')" />
<xsl:variable name="remaining" select="substring-after($newlist, '|')" />
<xsl:variable name="second" select="substring-before($remaining, '|')" />
<xsl:variable name="remainingNext" select="substring-after($remaining, '|')" />
<id>
<xsl:variable name="URL" select="concat('<a href=',$second, '></a>')"/>
<xsl:if test="$remainingNext">
<a>
<xsl:attribute name="href">
<xsl:value-of select="$second"/>
</xsl:attribute>
<xsl:value-of select="$first" />
</a>
<br/>
</xsl:if>
<br/>
</id>
<xsl:if test="$remainingNext">
<xsl:call-template name="output">
<xsl:with-param name="list" select="$remainingNext" />
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
 


Thanks, Jasper Paul
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsOther Extension...Other Extension...Need XSL to split a string from XML inputNeed XSL to split a string from XML input


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out