Created
December 26, 2014 22:13
-
-
Save bhdrkn/84a4a956b300987719f6 to your computer and use it in GitHub Desktop.
XSLT Tokenize Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet version="2.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://v1.helloworld.bahadirakin.com/" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" | |
exclude-result-prefixes="ns0 xs"> | |
<xsl:output method="xml" encoding="UTF-8" indent="yes" /> | |
<xsl:template match="/"> | |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" | |
xmlns:v1="http://v1.helloworld.bahadirakin.com/"> | |
<soapenv:Header /> | |
<soapenv:Body> | |
<sayHello xmlns="http://v2.helloworld.bahadirakin.com/" | |
xmlns:tns="http://schemas.xmlsoap.org/soap/envelope/"> | |
<xsl:attribute name="xsi:schemaLocation" | |
namespace="http://www.w3.org/2001/XMLSchema-instance"></xsl:attribute> | |
<xsl:for-each select="soapenv:Envelope/soapenv:Body/ns0:sayHello"> | |
<xsl:variable name="var1_resultof_cast" | |
select="string(*[local-name()='request' and namespace-uri()='']/*[local-name()='fullName' and namespace-uri()=''])" /> | |
<xsl:variable name="tokenizedList" select="tokenize($var1_resultof_cast,'\s+')"/> | |
<request xmlns=""> | |
<xsl:for-each select="$tokenizedList"> | |
<name><xsl:value-of select="."/></name> | |
</xsl:for-each> | |
</request> | |
</xsl:for-each> | |
</sayHello> | |
</soapenv:Body> | |
</soapenv:Envelope> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment