• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

XML and XSL help wanted:

Koing

Elite Member <br> Super Moderator<br> Health and F
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
 
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.
 
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
 
<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.
 
Originally posted by: Beau
<xsl:if test="count(error) &amp;gt; 1"><div class="error"><xsl:value-of select="error"/></xsl:if>

Thanks dude 😀 10 for you!

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

THANKS a lot 😀

Koing
 
Back
Top