をとるXSLTがあります。文字列を削除し、SQLステートメントの2つのフィールドに分割します。
<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'
これは機能しますが、非常に時間がかかります。誰かがより効率的なアプローチを見ることができますか?
ありがとう!