简体   繁体   English

如何将html标记放入XSL样式表?

[英]How put html tags into XSL stylesheet?

I have python script that converts data.xml to html using stylesheet.xsl. 我有使用stylesheet.xsl将data.xml转换为html的python脚本。 And i have a problem with inserting html tags into the stylesheet. 而且我在样式表中插入html标签存在问题。 I would like to put all the generated values into table cells. 我想将所有生成的值放入表单元格中。 maybe someone experienced could help me? 也许有经验的人可以帮助我?


  xsl:choose
    xsl:when test="$NECoords = 'true'"
      xsl:value-of select="concat($PtStr, $NthStr, $EastStr, $ElevStr, '  ', $TimeStr, $hzPrec, $vtPrec, $PDOP, $aRMS, $NbrSat, $NbrInt)"/>
    /xsl:when>
  
  

I would like to know how to put above concatenated strings into table cells in output html file, like: 我想知道如何将连接的字符串放在输出html文件的表格单元格中,例如:
在此处输入图片说明
Every value should be put to separate cell, like this: 每个值都应放在单独的单元格中,如下所示:
在此处输入图片说明

how about using 怎么样使用

string-join( (concat('<td>',$firsElement),..(elements)..,concat($lastElement,'</td>') ) ,'</td><td>')

I think that this code would generate something like 我认为这段代码会生成类似

<td>$firstElement</td><td>$secEl</td><td>..(n-cells)..</td><td>$lastElement</td>

I don't know if there are problems with the <td> elements, in this case you have to escape them ( &lt; &gt; ). 我不知道<td>元素是否存在问题,在这种情况下,您必须转义它们( &lt; &gt; )。

maybe you have to add this snippet to the xsl:stylesheet declaration. 也许您必须将此代码段添加到xsl:stylesheet声明中。

xmlns:fn="http://www.w3.org/2005/02/xpath-functions"

http://www.w3schools.com/xpath/xpath_functions.asp#string http://www.w3schools.com/xpath/xpath_functions.asp#string

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM