Some sort of xsl embedded in xml?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bonjo
    New Member
    • Oct 2013
    • 12

    Some sort of xsl embedded in xml?

    I wish to find some leads here.
    My desire is such - to define a UI of some sort by XML (similar to xaml with c#).
    I have a known xml elements / attributes and order.
    I also have another xml, that contains data.
    I wish to use conditions in my ui.xml that defines attribute's values according to the data.xml.
    example:
    ui.xml:
    Code:
    <root>
    <item title="if data/gender = 'female': Ms.; else: Mr." />
    </root>
    data.xml:
    Code:
    <data>
    <gender>male</gender>
    </data>
    So, in my very simple example, I want to somehow mix the two and get:

    result.xml:
    Code:
    <root>
    <item title="Mr." />
    </root>
    I know xsl is a known language for conditions on xml, that outputs html or xml (just by reading in the internet, not by known experience).
    Of course, the language of the condition is something I made up, and that is what I seek. Something with a known interpreter / behavior that I can rely on, instead of doing something from scratch.
    any help would be very appreciated.
    Thanks.
    Last edited by Rabbit; Oct 28 '13, 03:56 PM. Reason: Please use [CODE] and [/CODE] tags when posting code or formatted data.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    I know xsl is a known language for conditions on xml, that outputs html or xml
    XSL is not just conditions, it’s a programming language that transforms an XML document into something other (XML, HTML, Text, PDF, to name only the most common ones)

    Of course, the language of the condition is something I made up, and that is what I seek. Something with a known interpreter / behavior that I can rely on, instead of doing something from scratch.
    you can use any programming language (including XSL) to resolve the condition.
    there are two principal approaches:
    - read the XML as a data structure (requires that the language can actually load XML)
    - read the XML as text

    how to do that exactly depends (obviously) on the language used.

    Comment

    • bonjo
      New Member
      • Oct 2013
      • 12

      #3
      And how to I "tell" the xsl-to-xml engine to read an xml file and evaluate its attributes, where it indeed contains xsl code? is that possible? (in the form I supplied)

      Im doing the entire programming in JAVA, in case there're other approaches.
      I started thinking about using handlebars.java as a templating engine, and then simply read the input file as an xml, re-writing it while evaluating its attributes with handlebars.
      sadly, all those mustache kinds are logic-less, and I need logic.

      Thank you for your help

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        And how to I "tell" the xsl-to-xml engine to read an xml file and evaluate its attributes, where it indeed contains xsl code?
        this is language-specific. you should ask that in the forum of your language (Java Forum).

        Comment

        • bonjo
          New Member
          • Oct 2013
          • 12

          #5
          Well, you're right. Sorry for targeting it from one subforum to the other.
          I will continue my journey there.
          have a good day

          Comment

          Working...