在jenkins可编辑电子邮件上获取转换后的xml

时间:2016-02-03 18:34:17

标签: jenkins jenkins-plugins

詹金斯新手在这里。

在jenkins作业的工作区中有这个文件说Books.xml和BookStyle.xsl。 xml使用样式表xsl。如果我在firefox中打开Book.xml,我会得到正确的样式。

计划是在jenkins电子邮件的editable email内容中包含样式的xml文件的内容。

可编辑电子邮件的默认内容文本框为:

${FILE,path="versions.xml"}

这并没有显示发送的电子邮件中的任何样式。

我们如何在电子邮件中获得样式?

1 个答案:

答案 0 :(得分:1)

我无法找到使用xml内容和xsl样式创建电子邮件的方法。 实现此要求的另一种方法是创建C#或java代码以使用xml和xsl输入创建html文件。 在构建步骤中调用该脚本以创建html文件 然后在可编辑的电子邮件内容框中使用该html文件。

convert.cs

using System;
using System.Xml.Xsl;

class myclass
{
static void Main(string[] args)
{
// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("header.xsl");

// Execute the transform and output the results to a file.
xslt.Transform("versions.xml", "report.html");
}

}

构建步骤      csc convert.cs     CONVERT.EXE

可编辑的电子邮件内容框     的 $ {FILE,路径=" report.html"}