XML and XSL help wanted:

Koing

Elite Member <br> Super Moderator<br> Health and F
Oct 11, 2000
16,843
2
0
We have a php page.

If the page does receieve a year parameter that is numeric, then the XML error output (indicated by the <error> element) should use XSL to link against a CSS file 'main.css', which will cause the error message to be displayed with a two-pixel wide red border around the error message.

The problem is we are not getting the php page to check year parameter and if it isn't numeric we have to pass that to XML and get XSL to link against the CSS file. The border in red thing is fine but can you guys help out?

Thanks.

Koing
 

Koing

Elite Member <br> Super Moderator<br> Health and F
Oct 11, 2000
16,843
2
0
ttt as I'm off to sleep

Night AT'ers

Koing
 

Koing

Elite Member <br> Super Moderator<br> Health and F
Oct 11, 2000
16,843
2
0
ttt

For anyone who has ideas.

Thanks

Koing
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
Can you clarify what you are trying to accomplish?

1. Your PHP page receives a URL/FORM parameter called "year" which it validates as numeric
2. The PHP page generates XML that is subsequently transformed by an XSL
3. The XML is generated regardless of whether or not the parameter is valid
4. If the parameter is valid, the XSL should output one way. If it is invalid, it should output a different way.

If the above statements are true, then I disagree with number 3. In general, you want to keep your XSL documents simple and leave most of the validation and error handling to your server-side code (i.e. PHP). Your PHP page should validate the year parameter and redirect or output an error page apart from your main XSL. There's no reason to use an expensive XSL transformation operation to display something as simple as an error message.
 

Koing

Elite Member <br> Super Moderator<br> Health and F
Oct 11, 2000
16,843
2
0
Okay sorry for the confusion here goes:

Point 3: the XML is 'only' generated when the 'year' parameter is not numerical. This then gets passed to the XSL and then that links to a CSS that displays the error message with a crappy border. The assignment just says that.

It is the last point for us to do.

BUT we have submitted it in already BUT I'd LOVE to know for my own benefit anyway :)

Thanks MrChad 10 from me.

Koing
 

Beau

Lifer
Jun 25, 2001
17,730
0
76
www.beauscott.com
<xsl:if test="count(error) &amp;gt; 0"><div class="error"><xsl:value-of select="error"/></div></xsl:if>


Edit: I had a bug there... it's fixed now.
 

Koing

Elite Member <br> Super Moderator<br> Health and F
Oct 11, 2000
16,843
2
0
Originally posted by: Beau
<xsl:if test="count(error) &amp;gt; 1"><div class="error"><xsl:value-of select="error"/></xsl:if>

Thanks dude :D 10 for you!

I'll check it out when I am at Uni to test it out.

THANKS a lot :D

Koing
 

Koing

Elite Member <br> Super Moderator<br> Health and F
Oct 11, 2000
16,843
2
0
Oh I see.

AGAIN TOP MAN THANKS FOR THE HELP :cool:

Koing