连接字符串XSL

时间:2013-11-06 08:03:08

标签: html xml xslt

我在xml中有这些值

<xsl:variable name="template" select="mail/template"/>(以模板4的形式出现) <xsl:variable name="portalname" select="mail/portalname"/>(作为测试门户出现)

我需要像最后一样创建这样的东西

<LINK rel="stylesheet" href="/rezsystem/rezsystem_hansa/jboss-4.0.3SP1/server/default/deploy/RezgEmailService.war/xsl/testingportal/css/template4/rezbase_mail.css" type="text/css"/>

和像java一样

String str =  "/rezsystem/rezsystem_hansa/jboss-4.0.3SP1/server/default/deploy/RezgEmailService.war/xsl/"+ portalname+"/css/"+template+"/rezbase_mail.css";

如何在这种情况下进行连接。??

2 个答案:

答案 0 :(得分:3)

您必须使用attribute value templates

<LINK rel="stylesheet" href="/rezsystem/rezsystem_hansa/jboss-4.0.3SP1/server/defaultdeploy/RezgEmailService.war/xsl/{$portalname}/css/{$template}/rezbase_mail.css" type="text/css"/>

答案 1 :(得分:-2)

请参阅:http://www.w3schools.com/xpath/xpath_functions.asp

<xsl:value-of select="concat('/rezsystem/rezsystem_hansa/jboss-4.0.3SP1/server/default/deploy/RezgEmailService.war/xsl/', $portalname, '/css/', $template, '/rezbase_mail.css')" />

或使用string-join

<xsl:value-of select="string-join(('/rezsystem/rezsystem_hansa/jboss-4.0.3SP1/server/default/deploy/RezgEmailService.war/xsl/', $portalname, '/css/', $template '/rezbase_mail.css'))" />