xslt需要选择一个单引号 [英] xslt need to select a single quote

查看:92
本文介绍了xslt需要选择一个单引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要这样做:

 < xsl:with-param name =callmeselect ='validateInput (这一点, '一个');'/> 

我读过在xslt concat函数中转义单引号,它告诉我用<$ c替换' $ c>& 我已经完成了,但它仍然没有工作..



有谁知道我们该如何解决这个问题? :

 < xsl:with-param name =callmeselect ='validateInput(this,& an& amp ;')的;'/> 


解决方案

版本的XSLT

 < xsl:variable name =vApos>'< / xsl:可变> 

我经常使用相同的技术来指定引用 p>

 < xsl:variable name =vQ>< / xsl:variable> 
来将任何这些变量插入到任何文本中。 concat()

  concat('This movie is named',$ vQ,'Father' ,$ vApos,'secrets',$ vQ)

strong>:

 < xsl:stylesheet version =1.0
xmlns:xsl =http:// www.w3.org/1999/XSL/Transform\">
< xsl:output method =text/>

< xsl:variable name =vApos> ;'< / xsl:variable>
< xsl:variable name =vQ>< / xsl:variable>

< xsl:template match =/>
< xsl:value-of select =
concat('这部电影名为',$ vQ,'Father',$ vApos,'secrets',$ vQ)
/>
< / xsl:template>
< / xsl:stylesheet>

产生

 这部电影被命名为父亲的秘密


i need to do this:

<xsl:with-param name="callme" select="'validateInput(this,'an');'"/>

I've read Escape single quote in xslt concat function and it tells me to replace ' with &apos; I've done that yet its still not working..

Does anyone know how do we fix this?:

<xsl:with-param name="callme" select="'validateInput(this,&apos;an&apos;);'"/>

解决方案

Something simple that can be used in any version of XSLT:

<xsl:variable name="vApos">'</xsl:variable>

I am frequently using the same technique for specifying a quote:

<xsl:variable name="vQ">"</xsl:variable>

Then you can intersperse any of these variables into any text using the standard XPath function concat():

concat('This movie is named ', $vQ, 'Father', $vApos, 's secrets', $vQ)

So, this transformation:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output method="text"/>

  <xsl:variable name="vApos">'</xsl:variable>
  <xsl:variable name="vQ">"</xsl:variable>

    <xsl:template match="/">
        <xsl:value-of select=
        "concat('This movie is named ', $vQ, 'Father', $vApos, 's secrets', $vQ)
    "/>
    </xsl:template>
</xsl:stylesheet>

produces:

This movie is named "Father's secrets"

这篇关于xslt需要选择一个单引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆