質問

I have à parameter that I passed to my xsl stylsheet from command line (I m using saxon 9), my parameter "emails" is as follows:

<xsl:param name="emails" select="emails"/> 

and its value: "john.doe@corp.com,jane.doe@corp.com,..."

My param can contain multiple emails.

I want to catch each email and assign it to a variable: $email1, $email2, $email3 ...

Once I have my variable I need to do some checks depending on these variables:

<xsl:if test="./text()=$email1">
     <!-- some operations -->
</xsl:if>
<xsl:if test="./text()=$email2">
     <!-- some operations -->
</xsl:if>
...

How can I proceed (XSLT 2 /xpath 2 ) ??

Thanks !!

役に立ちましたか?

解決

In Xpath 2 you can use tokenize to split the mail addresses:

tokenize($emails, ",")

E.g, in XSLT probably:

 <xsl:variable name="email" select="tokenize($emails, ',')"/>

Then you can access them with $email[1], $email[2], ...

That makes more sense than using "$email1"

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top