下面是用于触发和发送电子邮件的XSLT
订购活动表格或以单词presentation开头的产品时,我需要发送电子邮件。
当前,当我从电子邮件订购事件时,但是如果我订购演示文稿,则电子邮件未发送,我认为这是因为我没有正确使用Starts-with fucntion。
任何人都可以看到问题吗?
from flask import Flask, render_template, request
from flask_mysqldb import MySQL
import yaml
import sys
app = Flask(__name__)
db = yaml.load(open('db.yaml'))
app.config['MYSQL_USER'] = db['mysql_user']
app.config['MYSQL_PASSWORD'] = db['mysql_password']
app.config['MYSQL_DB'] = db['mysql_db']
mysql = MySQL(app)
@app.route('/')
def dashboard():
return render_template('dashboard.html')
@app.route('/sdetails')
def sdetails():
return render_template('s.html')
@app.route('/s', methods = ['POST', 'GET'])
def s():
dbhosts = yaml.load(open('yamlsample.yaml'))
dbhosts = list(dbhosts)
if request.method == 'POST':
result = request.form
sname = request.form["Name"]
for i in dbhosts:
app.config['MYSQL_HOST'] = i
cur = mysql.connection.cursor()
slist=cur.execute(slist=cur.execute("select * from table1 WHERE table1.name LIKE '{}'".format(sname))
sdetails=cur.fetchall()
if sdetails != None:
return render_template('results.html', sdetails=sdetails)
else:
continue # I thought continue will take me to the next dbhost. But not happening.
if __name__ == '__main__':
app.run(debug = True)
答案 0 :(得分:1)
不看XML很难给出准确的答案,但是要写这个...
//Sqls/OrderProduct/Row/ProductName != starts-with(ProductName, 'Presentation')
您可能想要的语法是
//Sqls/OrderProduct/Row[not(starts-with(ProductName, 'Presentation'))]
但是,您的完整表达式还会检查“ EventName”,因此,实际上需要将两个表达式合并为一个,就像这样:
<xsl:if test="//Sqls/OrderProduct/Row[ProductName != 'Event Form' and not(starts-with(ProductName, 'Presentation'))]">
编辑:或者也许您需要此,具体取决于您要实现的逻辑
<xsl:if test="not(//Sqls/OrderProduct/Row[ProductName = 'Event Form' or starts-with(ProductName, 'Presentation')])">