Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <xsl:for-each select="tokenize(Path,'.')">
- <xsl:choose>
- <xsl:when test="position() = 1 and position() = last()">SITE = '<xsl:value-of select="."/>' AND PATH = ''</xsl:when>
- <xsl:when test="position() = 1 and position() != last()">SITE = '<xsl:value-of select="."/>' </xsl:when>
- <xsl:when test="position() = 2 and position() = last()">AND PATH = '<xsl:value-of select="."/>' </xsl:when>
- <xsl:when test="position() = 2">AND PATH = '<xsl:value-of select="."/></xsl:when>
- <xsl:when test="position() > 2 and position() != last()">.<xsl:value-of select="."/></xsl:when>
- <xsl:when test="position() > 2 and position() = last()">.<xsl:value-of select="."/>' </xsl:when>
- <xsl:otherwise>zxyarglfaux</xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- INPUT: North OUTPUT: SITE = 'North' AND PATH = ''
- INPUT: North.A OUTPUT: SITE = 'North' AND PATH = 'A'
- INPUT: North.A.B OUTPUT: SITE = 'North' AND PATH = 'A.B'
- INPUT: North.A.B.C OUTPUT: SITE = 'North' AND PATH = 'A.B.C'
- <xsl:text>Site = '</xsl:text>
- <xsl:value-of select="substring-before(Path,'.')"/>
- <xsl:text>' AND PATH = '</xsl:text>
- <xsl:value-of select="substring-after(Path,'.')"/>
- <xsl:text>'</xsl:text>
- <xsl:text>SITE = '</xsl:text>
- <xsl:choose>
- <xsl:when test="contains($Path, '.')>
- <xsl:value-of select="substring-before($Path, '.')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$Path"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text>' AND PATH = '</xsl:text>
- <xsl:value-of select="substring-after($Path, '.')"/>
- <xsl:text>'</xsl:text>
- <xsl:value-of select="string-join( 'SITE = ', substring-before(concat(Path,'.'),'.'),
- ' AND PATH = ', substring-after(Path,'.'), ' '), '''')" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement