xsl-list
[Top] [All Lists]

Question with XSLT: pass parameters to JSP

2003-03-12 08:52:17
My questions is that when I use <xsl:for-each select="DataSource"> to get @name of EACH DataSource, how could I pass this value as a parameter to a JSP page? Like in the following "users-attr.xsl". Because every time, it just return me "//DataSource[1]/@name", How could I get "//DataSource[i]/@name"(i=1..n) and pass EACH {(_at_)name} to the JSP page?

Another question, when I try to pass two <xsl:variable> to a JSP page as parameters, I met a question with the second parameter:
<a href="nextstep.jsp?p1={$param1}&p2={$param2}">next step</a>

Could anyone please tell me how should I do to get them?

Thanks in advance!

Ping

//users-attr.xsl;
        <TABLE BORDER="2">
                <TR>
                        <TD>Name</TD>
                        <TD>Type</TD>
                        <TD>Attributes</TD>
                        <TD>RuleSets</TD>
                </TR>
                <xsl:for-each select="DataSource">
                <TR>
                        <TD><font color="blue"><xsl:value-of 
select="@name"/></font><br/></TD>
                        <TD><font color="blue"><xsl:value-of 
select="@type"/></font><br/></TD>
<TD><font color="blue"><a href="editAttribute(_dot_)jsp?dsname={(_at_)name}">edit</a></font><br/></TD> <TD><font color="blue"><a href="editRuleSets(_dot_)jsp?dsname={(_at_)name}">edit</a></font><br/></TD>
                </TR>
                </xsl:for-each>
        </TABLE>

        <xsl:variable name="param1" select="//DataSource[1]/@name"/>
        <xsl:variable name="param2" 
select="//DataSource[1]/X-RuleSet[1]/@name"/>

        <a href="nextstep.jsp?p1={$param1}&p2={$param2}">next step</a>

//users-attr.xml;

<?xml version="1.0" encoding="UTF-8"?>
<?xml:stylesheet type="text/xsl" href="users-attr.xsl"?>
<!DOCTYPE PMML PUBLIC "Vacuum 1.0" "users.dtd">
<PMML version="2.0">
<Header/>
<DataSource name="ds1" type="database">
<X-Database driver="sun.jdbc.odbc.JdbcOdbcDriver" password="user" table="t1" url="jdbc:odbc:test" username="user"/>
<DataDictionary numberOfFields="2">
<DataField isCyclic="0" name="a" optype="continuous"/>
<DataField isCyclic="0" name="b" optype="continuous"/>
</DataDictionary>
<X-RuleSet name="rs1">
<X-Rule name="r1" type="bin">
<X-BinaryRule lag="1" leftSide="a" operator="lt" rightSide="b" type="laggedAttribute" useGrouping="0"/>
</X-Rule>
<X-Rule name="r2" type="bin">
<X-BinaryRule lag="0" leftSide="a" operator="lt" rightSide="b" type="attribute" useGrouping="0"/>
</X-Rule>
<X-Rule name="r3" type="bin">
<X-BinaryRule lag="0" leftSide="a" operator="lt" rightSide="3" type="value" useGrouping="0"/>
</X-Rule>
<X-Rule name="r4" type="cond">
<X-ConditionalRule attribute="a" useGrouping="0">
<X-Literal>AND</X-Literal>
<X-Literal>(</X-Literal>
<X-Literal>
<X-BinaryRule lag="0" leftSide="a" operator="gt" rightSide="1.0" type="value" useGrouping="0"/>
</X-Literal>
<X-Literal>)</X-Literal>
<X-BinaryRule lag="0" leftSide="a" operator="gt" rightSide="1.0" type="value" useGrouping="0"/>
</X-ConditionalRule>
</X-Rule>
<X-Rule name="rrrrr" type="bin">
<X-BinaryRule lag="0" leftSide="a" operator="lt" rightSide="1" type="value" useGrouping="0"/>
</X-Rule>
</X-RuleSet>
</DataSource>
<DataSource name="ds2" type="database">
<X-Database driver="sun.jdbc.odbc.JdbcOdbcDriver" password="user" table="t1" url="jdbc:odbc:test" username="user"/>
<DataDictionary numberOfFields="2">
<DataField isCyclic="0" name="a" optype="continuous"/>
<DataField isCyclic="0" name="b" optype="continuous"/>
</DataDictionary>
<X-RuleSet name="rs1">
<X-Rule name="r1" type="bin">
<X-BinaryRule lag="1" leftSide="a" operator="lt" rightSide="b" type="laggedAttribute" useGrouping="0"/>
</X-Rule>
<X-Rule name="r2" type="bin">
<X-BinaryRule lag="0" leftSide="a" operator="lt" rightSide="b" type="attribute" useGrouping="0"/>
</X-Rule>
<X-Rule name="r3" type="bin">
<X-BinaryRule lag="0" leftSide="a" operator="lt" rightSide="3" type="value" useGrouping="0"/>
</X-Rule>
<X-Rule name="r4" type="cond">
<X-ConditionalRule attribute="a" useGrouping="0">
<X-Literal>AND</X-Literal>
<X-Literal>(</X-Literal>
<X-Literal>
<X-BinaryRule lag="0" leftSide="a" operator="gt" rightSide="1.0" type="value" useGrouping="0"/>
</X-Literal>
<X-Literal>)</X-Literal>
<X-BinaryRule lag="0" leftSide="a" operator="gt" rightSide="1.0" type="value" useGrouping="0"/>
</X-ConditionalRule>
</X-Rule>
<X-Rule name="rrrrr" type="bin">
<X-BinaryRule lag="0" leftSide="a" operator="lt" rightSide="1" type="value" useGrouping="0"/>
</X-Rule>
</X-RuleSet>
</DataSource>
</PMML>



_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>
  • Question with XSLT: pass parameters to JSP, Ping Chen <=