Link to home
Start Free TrialLog in
Avatar of Midani22
Midani22

asked on

Help with XSL

<xsl:variable name="parentId" select="substring-before(substring-after(concat($querystring, '&'), 'parentid='), '&')"/>

If the variable name is a session already available to the application, is the above needed?


<xsl:if test="@id = 'SelectReporting' and not(contains('#2#10#192#15#169#189#230#', concat('#', $parentid, '#')))">

if I want to keep parentid and not concatenate, how do I edit the above, also do I need the last "#" on the above referenced line?

thanks, M.
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

preferably you pass the parentid in from the caller to teh XSLT other than the query string.
No you don't need that substring operation then

you don't concatenate the parentid,
you just concatenate a "#" before and after temporarily in order to do the compare
you need all the hashes as in my example to not have false hits

if parent id would be "23" and you don't test for "#23#" but "#23" instead
you would get a false hit on the #230#
Avatar of Midani22
Midani22

ASKER

This is an example of what another developer did:

<!--xsl:if test="@id='SelectReporting' and not($state='FL')">
                                                <xsl:attribute name="STYLE">display:none</xsl:attribute>
</xsl:if-->
                   

This is what you said I think you said:

<xsl:if test="@id = 'SelectReporting' and not(contains('#2#10#192#15#169#189#230#', concat('#', $parentid, '#')))">
<xsl:attribute name="STYLE">display:none</xsl:attribute>
</xsl:if>

If this is not it, can you elaborate one last time? Thanks, Michele
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The parentid is not present in the xml file. How do I trace it and show it?

The xml is below:
NavBar.xsl
Well Michele, that is something I can't possibly know. That is information you should give me before I can help.

Can you briefly explain what this application does?

I understand you have a servlet and that servlet gets a request?
Do you want information from that request passed on to the XSLT process?
Your servlet will have knowledge about the query string and can split it out in parameters
These parameters can be passed to your stylesheet by addParam (or something similar, I am not a Java programmer)

Or does you parentid needs to be calculated from values in the XML or one of the parameters? Then I need info on where to get it from

I see you made the parentid a variable in the XSLT. If you want to pass it in, it should be an xsl:param, not a xsl:variable
Do you want information from that request passed on to the XSLT process?
yes

the servlet does not specifically reference the parentid however, I have not mentioned it in the xls file and finally, it does not properly show these values against the previously written xsl statement that you worked on earlier today.

The servlet is attached.

We wondered how we would be able to properly reference the parentid in the .xls file and get it to show. We had no problems with this one for instance:

</xsl:if>
                    <!--xsl:if test="@id='SelectReporting' and not($state='FL')">
                                                <xsl:attribute name="STYLE">display:none</xsl:attribute>
doLogin.java
well main difference is that state is a parameter and parentId is a variable (note that names are case sensitive in XML)

The java you send me does not have code for processing the XSLT, so there is no way I can reference the process in it