Results 1 to 11 of 11

Thread: Cornedbee: Lookie here!(XML/XSL Question if anyone else is good at that) *Resolved*

  1. #1

    Thread Starter
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    Cornedbee: Lookie here!(XML/XSL Question if anyone else is good at that) *Resolved*

    You seem to be the expert on all theese standard w3c things =). So I'm trying to make my first really valid webpage(which is to look nice ), and I'm using XML, and XSL(I don't convert it to XHTML)... So, what I wanna know is, if it's possible to send a variable to my XML file, which can be catched and used by XSL? My first though was to use javascript, but since I need to do something like this: <xsl:value-of select="node1/node2/<myvar>"> I run into a problem since I can't embed JavaScript in the XSL tag... So, what do I do ? =)
    Last edited by vbNeo; Jun 28th, 2004 at 10:17 AM.
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I'm not at all an expert on XSLT, but there are parameters. I don't know how to set them though.
    http://www.w3.org/TR/xslt#variables
    Maybe your XSLT processor converts GET arguments (?foo=bar) to parameters. I doubt it though.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    Originally posted by CornedBee
    I'm not at all an expert on XSLT, but there are parameters. I don't know how to set them though.
    http://www.w3.org/TR/xslt#variables
    Maybe your XSLT processor converts GET arguments (?foo=bar) to parameters. I doubt it though.
    Well, I did some googling before posting here and it seems you can't use it's parameters(which are just constants) in the XPath query. Guess I'm gonna have to do it in XHTML to get a dynamic website =(.

    And by the way, my parser is the one MoZilla uses, ehm... XCOM or something like that?
    Last edited by vbNeo; Jun 25th, 2004 at 05:53 AM.
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Mozilla's implementation. No idea what's it called, XPCOM is merely the system on which it works.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    Well, it seems XML really is bad for doing web pages ?
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    XML isn't "good" or "bad" in itself. It's a meta-language. XML is just a set of strucural rules that define the stuff with tags. An actual language is defined by an XML Schema or a DTD, both of which say which tags can be used, what attributes they have, what content they have. You also need a written (or at least memorized) definition of what the tags are for. You can have a <para> tag, but the only thing that actually makes it a paragraph is that the application that uses the XML knows it.

    Mozilla can't do anything with XML except displaying the document tree. However, it can recognize XHTML through the namespace and display it according to the rules it knows. It can recognize SVG and display it if it has built-in support. It can recognize MathML, XUL, XBL, XSLT, ...

    If you want your own XML language to be processed you need to write an application or instructions for an existing application that does so. You could, for example, write a PHP script that reads the XML and writes (X)HTML. You would have written an application that knows your XML language.
    You could write an XSLT sheet and pass it to Mozilla, and Mozilla would apply it to the XML. You would have written instructions for an application so that the application can do something with your XML.
    The latter, however, is under restrictions, namely the restrictions of whatever language the instructions are in. If XSLT doesn't allow you to process GET parameters then you have to find a different way of displaying your XML. That's not the fault of XML itself, though.


    Maybe you can show me what your XML looks like and what you want to do with it.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7

    Thread Starter
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    Originally posted by CornedBee
    XML isn't "good" or "bad" in itself. It's a meta-language. XML is just a set of strucural rules that define the stuff with tags. An actual language is defined by an XML Schema or a DTD, both of which say which tags can be used, what attributes they have, what content they have. You also need a written (or at least memorized) definition of what the tags are for. You can have a <para> tag, but the only thing that actually makes it a paragraph is that the application that uses the XML knows it.

    Mozilla can't do anything with XML except displaying the document tree. However, it can recognize XHTML through the namespace and display it according to the rules it knows. It can recognize SVG and display it if it has built-in support. It can recognize MathML, XUL, XBL, XSLT, ...

    If you want your own XML language to be processed you need to write an application or instructions for an existing application that does so. You could, for example, write a PHP script that reads the XML and writes (X)HTML. You would have written an application that knows your XML language.
    You could write an XSLT sheet and pass it to Mozilla, and Mozilla would apply it to the XML. You would have written instructions for an application so that the application can do something with your XML.
    The latter, however, is under restrictions, namely the restrictions of whatever language the instructions are in. If XSLT doesn't allow you to process GET parameters then you have to find a different way of displaying your XML. That's not the fault of XML itself, though.


    Maybe you can show me what your XML looks like and what you want to do with it.
    Well, basically, what I wanted to do was have an XML file which could hold content for my entire webpage, for example:

    Code:
    <webpage>
           <navigation>
                   <link ... />
                   <link ... />
                   <link ... />
           </navigation>
      
           <frontpage>
                   <header />
                    <date />
                    <content />
            </frontpage
    </webpage>
    ^^ - This is not my actual XML, just something I wrote here, but it's basically the same.

    What I want to do is to manipulate my XSLT sheet based on what page I want to view, since I get values from my xml document with XPath - so I need to this

    <xsl:value-of select="webpage/thepageiwant/header" />

    "thepageiwant" being a variable I pass, through the address bar... Since navigation should work that way.

    I hope you understand what I'm trying to do
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Not a good idea. It makes the browser effectively download your whole site for every page. Because of the parameters, it can't even cache.

    Nah, better to let the file be parsed by the server.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  9. #9

    Thread Starter
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    And just use XHTML without XSLT ?
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  10. #10
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Yeah.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  11. #11

    Thread Starter
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    Originally posted by CornedBee
    Yeah.
    Okay - Thanks for helping out, gonna do something about it tonight then =).
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width