“Artproof”变量是真的。 如果变量为真,我想改变文本的颜色
def conversations_for(query)
wildcarded_query = "%#{query}%"
user_ids = User.where('CONCAT(first_name, " ", last_name) LIKE :query', query: wildcarded_query).pluck(:id)
current_user.mailbox.conversations.
joins(:messages).
references('mailboxer_conversations, mailboxer_notifications, mailboxer_receipts, messages_mailboxer_conversations, mr, mn'). # To get rid of warnings
select('mailboxer_conversations.*, mailbox_type, trashed').
where("mailboxer_notifications.subject LIKE :query
OR mailboxer_notifications.body LIKE :query
OR mailboxer_notifications.sender_id IN (:user_ids)
OR EXISTS ( SELECT * FROM mailboxer_receipts mr
INNER JOIN mailboxer_notifications mn ON mn.id = mr.notification_id
WHERE mn.conversation_id = mailboxer_conversations.id
AND mr.notification_id IN ( SELECT id FROM mailboxer_notifications
WHERE sender_id = :current_user_id )
AND mr.receiver_id IN (:user_ids))",
query: wildcarded_query, user_ids: user_ids, current_user_id: current_user.id)
end
设置颜色条件为:
“color_of_artproof”变量给出Null值,文本为黑色。
答案 0 :(得分:0)
变量的范围限定为其父元素。如果在xsl:when
指令中定义变量,则不能在其他上下文中使用它。
尝试类似:
<xsl:variable name="color_of_artproof">
<xsl:when test="$ArtProof = 'True'">green</xsl:when>
<xsl:otherwise>red</xsl:otherwise>
</xsl:variable>