记住xslt中回发时选择的项目

时间:2023-01-07 22:59:56

I'm fixing an old website at my work. I'm kind of new at this job and I'm currently looking for a way to remember the selected item in an xslt file on postback, I don't really know anything about xslts so I'm asking here.

我正在修复一个旧网站。我对这项工作有点新意,我正在寻找一种方法来记住回发中xslt文件中的所选项目,我对xslts一无所知,所以我在这里问。

drop down I want to remember:

下拉我想记住:

<select id="filtertype" class="subscriptionselector" onchange="changeFilter()">
    <option value="present">Present</option>
    <option value="notpresent">Not Present</option>
    <option value="noreply">No reply</option>
</select>

what do I have to put in my code so then when a postback happens (because a button is pressed) that the filtertype doesn't get reset every time.

我需要在代码中添加什么,以便在发生回发时(因为按下按钮),每次都不会重置过滤类型。

1 个解决方案

#1


1  

If I understood well, you try to keep a state between two XSLT calls. It's not possible. But you can add a parameter (possibly a node), that you pass to your XSLT with a value you keep in memory between two calls. For example :

如果我理解得很好,你会尝试在两次XSLT调用之间保持状态。这是不可能的。但是你可以添加一个参数(可能是一个节点),你传递给你的XSLT,并在两次调用之间保留在内存中的值。例如 :

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
    <xsl:param name="lastNode" as="node()"/>
    ...
</xsl:stylesheet>

#1


1  

If I understood well, you try to keep a state between two XSLT calls. It's not possible. But you can add a parameter (possibly a node), that you pass to your XSLT with a value you keep in memory between two calls. For example :

如果我理解得很好,你会尝试在两次XSLT调用之间保持状态。这是不可能的。但是你可以添加一个参数(可能是一个节点),你传递给你的XSLT,并在两次调用之间保留在内存中的值。例如 :

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
    <xsl:param name="lastNode" as="node()"/>
    ...
</xsl:stylesheet>