0

I have a problem with printing PDF file from a Java project that is adding parameters in the XLS file. The project read the XML file, then he is generate a PDF file from the XSL style sheet. See below for the content of the files.
As you see in the XLS file I want to specified at “studentNumber”, but the problem is that is specified “studentNumber” need to set in the Java project. I have tried a lot of thing and search on internet but I cannot find the answer. Any idea want I need to change to make this project proper.

XML file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="studentResultXLS.xsl"?>
<cursus>
    <enroll>
        <studentnumber>s484766</studentnumber>
        <cursuscode>ISDTCEX.B627</cursuscode>
        <enrolldate dateformat="eejjmmdd">20111121</enrolldate>
        <acquire>ja</acquire>
        <grade>4</grade>
        <result></result>
    </enroll>
    <enroll>
        <studentnumber>s484766</studentnumber>
        <cursuscode>ISDTSIP.T470</cursuscode>
        <enrolldate dateformat="eejjmmdd">20111116</enrolldate>
        <acquire>ja</acquire><grade>2</grade>
        <result></result>
    </enroll>
    <enroll>
        <studentnumber>s484767</studentnumber>
        <cursuscode>ISDTSIP.T470</cursuscode>
        <enrolldate dateformat="eejjmmdd">20111116</enrolldate>
        <acquire>ja</acquire><grade>2</grade>
        <result></result>
    </enroll>

</cursus>

XLS file:

<xsl:param name="studentnumber"/>.....

<fo:table-body>
    <xsl:for-each select="/cursus/enroll[studentnumber='s484766']">
        <fo:table-row>

            <fo:table-cell>
                <fo:block> <xsl:value-of select="studentnumber"/> </fo:block>
            </fo:table-cell>

                <fo:table-cell>
                    <fo:block> <xsl:value-of select="cursuscode"/> </fo:block>
                </fo:table-cell>
            </fo:table-row>
    </xsl:for-each>
    </fo:table-body>

Java code:

 transformer.setParameter("studentnumber", "s484766");

1 Answer 1

2

For reading the parameter value, you need to prefix it with a $ sign:

<xsl:value-of select="$studentnumber"/>
Sign up to request clarification or add additional context in comments.

1 Comment

Thx, the solution was indeed the $ sign: I have used the follow code in the XLS file for working proper: <xsl:for-each select="/cursusinschrijvingen/inschrijving[studentnummer=$studentnummer]">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.