Xml2xml (or Sort Xml) With Xsl?

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > HTML, XML etc..

Xml2xml (or Sort Xml) With Xsl?

kvarnerexpress
Hi, my first steps in XML, so maybe even my concept is not the appropriate one, but let's start at the beginning:

Input:
I've got an XML file:


PHP:
--------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<publications>
<publication SourceName="Plumtree" SourceUNID="698">
<title>STAT 2003 Q2: Factual</title>
<category>_Hidden_01. Closing Documents -STAT-</category>
<security users="" groups="1,51"/>
</publication>
...

--------------------------------------------------------------------------------



Output:
I need to have an XML file, which is sorted first by category and second by title.

Black Box:
I think I should use XSL, right?

My approach:



Add to the XML: <?xml-stylesheet type="text/xsl" href="sortPublications.xsl"?>

Write an XSL as following:


PHP:
--------------------------------------------------------------------------------

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl<img src="images/smilies/redface.gif" border="0" alt="">utput method="xml" encoding="UTF-8" indent="yes"/>

<publications>
<publication>
<xsl:sort select="category"/>
<xsl:sort select="title"/>
<xsl:attribute name="category">
<xsl:value-of select="category"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="title"/>
</xsl:attribute>
<xsl:attribute name="security">
<xsl:attribute name="users">
<xsl:value-of select="users"/>
</xsl:attribute>
<xsl:attribute name="groups">
<xsl:value-of select="groups"/>
</xsl:attribute>
</xsl:attribute>
</publication>
<publication>

</xsl:stylesheet>

--------------------------------------------------------------------------------



But, hmm, XSL does not work as I do... you've got some hints?

 

 

 


Reply

eiteljoh
appears your trying out the same things i was ... definately go to the w3cschool and find the xml/xslt sections ... it's actually quite good. the other thing i just find is xslt works much different for IE and netscape/mozilla/etc. i eventually abandoned this because my audience is not just IE. i really don't like it ... it's like we're back 10 yrs ago where you have to do browser test and re-program for diff types ohmy.gif(

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Similar Topics

Keywords : xml2xml, sort, xml, xsl

  1. Guestbooks
    How to sort out a guestbook (0)
  2. Will There Be Any Sort Of Credit Return?
    (19)
    Hey guys, I was wondering if there would be any sort of credit return for the days the websites were
    down. I lost about six or seven days worth of hosting without being able to view my site, so if
    possible I'd liek at least some of that back. Thanks for listening! /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />....
  3. Runescape 2 Private Server: Code/guide 2
    Sort of minigame, not too good (0)
    Can a mod please lock?....
  4. .nol's Main Title Tutorial #2
    This goes along with the IF skinning tutorial sort of. (2)
    Hello, welcome to my maintitle tutorial #2. If I can find my first one, I will be glad to post it,
    but I think this ones better anyways. If you are able to see massive images, you can go to the
    bottom and view that tutorial, it might be easy anyways. We will be using Photoshop Cs2, but it
    really shouldn't matter This tutorial will help you create something like this: (please
    note thisi is a little skinnier in length then your creating, and probably a little taller too)
    Alright well lets get started, before we start please download the download just above the l....
  5. My Experience With A Girl I Met Last Fall.
    its not of the nice sort :\ (2)
    I met her at September of last year, at one of my usual evening strolls around the neighborhood. she
    was walking her sister's chiwawa. (I usually love dogs, but that breed is not my favorite, to
    say the least. thats just a side note.) At first glance, she looked much younger than I am (She was
    31, I'm 25), I gave her 20 at the top. It was a period not long after my girlfriend, with whom
    i have been dating for about 4 to 5 months, dropped me like you get rid of a disease, so I was kinda
    broken (hence those "calm up" strolls i made into a habit, since I tended to....
  6. Css-based "i-frames" (sort Of)
    A couple of ways to do it... (1)
    I got thinking that it might be nice to have a method to load a bunch of pictures up to a site, but
    not have them taking up a lot of space. And without using a bunch of php, while still presenting the
    entire picture. And using full-on CSS coding, not tables or frames. So here you go... a "picture in
    a picture" method. A CSS framed picture And a "hidden" "picture in a picture" method. A
    "hidden" CSS framed picture Sort of a way to 'hide the picture and let the user decide if they
    want to actually see the image. All it does is use positioning for placing the....
  7. Link Exchange(sort Of)
    (4)
    Hey everyone, I want to start a link exchange on my site. You can see the current link exchange by
    going to this link. The Link Exchange Just an F.Y.I , I already added a few of my members links.
    And I also added Trap17. If you are interested there are two ways to get your link on my page!
    1. Just post your link along with a description and an optional banner or Register at my site and
    then submit your site manually. I do not want any linkage back! Thanks!....
  8. Control Panel: Current Subscriptions
    Sort by new posts (0)
    I don't know about you guys, but I find the current subscriptions page
    (http://www.trap17.com/forums/view-topic-subscriptions.html) one of the most useful features of this
    forum. As such, I have two ideas to make this tool even better. 1) Have the topics listed on page
    be sorted into two sections: one for new posts (at the top) and the other for topics without any new
    replies. 2) Make the topic subscriptions page be the default destination when you click the 'My
    Controls' link. Or at least swap out the "Recently Read Topics" in favor for it. (I made this....
  9. How To Sort Files Of A Directory using Php
    (11)
    The following code displays the files of folder...but they are displaced by the order of adding... i
    want to sord the files / folders alphabetically and sord by accending order and by decending
    order.. can some one help me. $path = ""; $dir_handle = @opendir($path) or
    die("Unable to open $path"); echo "Directory Listing of $path "; while($file =
    readdir($dir_handle)) { if(is_dir($file)) { continue; } else
    if($file != '.' && $file != '..') { echo " $fi....
  10. Edit: Gah, Forum Glitch, Sorry. Please Delete
    Read my other post, this one was some sort of glitch (0)
    Please read my other application post, this one was some sort of forum glitch, or my internet
    connection got messed. Really sorry Canada....
  11. I Sort Of Need Help For The Rest Of The Process
    (3)
    This is kinda pre-sales... Ok, I registered a domain name with Yahoo. It said maybe 75 hours till
    it gets fully up, then right after I went and bought the 9.99 package at ComputingHost leaving the
    note for someone to take everything from my Trap17.com site to there, but i forgot to leave a link
    to my profile. Also when I signed up a I used the domain name that is still pending for the 75
    hours. So now I can't access anything yet? when will everything be ready? and just for OpaQue
    to know if your the one who moves stuff from the Trap17 sites to there, that was me wh....
  12. Motherboard Troubles (of Any Sort)
    post up when stuff happens to get help. (3)
    So basically, I have an Abit av8 thats giving all sorts of trouble. Whenever I try to play any type
    of highly 3d game, it crashes after about 5 minutes. I've read about the htt issues, and have
    lowered the htt multiplier...still no result. I've updated bios,drivers, re-seated the
    card...everything. Still crashes sporadically on stock settings. I'm sure its not any other
    component of the computer. Has anyone else had this problem/have the same setup as I do? Please
    help, resetting multiple times a day when I am in the middle of something is really annoying!....
  13. Does Your School Have Well-defined Cliques?
    A sort of social order, if you will. (27)
    For those who don't know, cliques are basically groups of people that hang around together. It
    can be a small group of friends or a whole social group. Most stereotypical high schools have the
    nerds, punks, preps, ghetto, goths, emos/skaters, losers, etc., but are most high schools very
    stereotypical? I wouldn't really know since I go to a magnet high school for nerds, so the
    social classes are kind of blurred together. The nerds are friends with the preps, few people are
    considered losers, there's no ghetto, and we only had one goth for about a week. Also, ....
  14. How To Store The Text Typed In A Form?
    sort of newsletter subsciption form (5)
    i would like to add a form on my site, that let's you fill in your e-mail address in order to
    subscribe to a newsletter. Actually, i just need to see their addresses somewhere (in a textfile,
    database, forward to my e-mailaddress,..). How can this be done? I mean, which script do i have to
    use? There is a database available. Php is enabled. I have no acces to cgi-bin, if that's
    needed. I hope someone can help me with this. The alternative would be that there is a link on my
    site so that they can mail it to me, but prefer a script /smile.gif' border='0' styl....
  15. What Sort Of Music Do You Listen To?
    What sort of music do you listen to? (72)
    Hi Everyone, Since I'm new, I just was wondering what sort of musical tastes everyone has. My
    favorite types of music are hard rock and metal. I also like 70s rock (Led Zeppelin, Yes, Rush, etc)
    and I like the more modern stuff, too (White Stripes, The Hives, Audioslave). My favorite band is
    U2. But I pretty much listen to anything (depends on my mood).....
  16. How Much Bandwidth Do You Use?
    monthly. Just a sort of survey. (2)
    I see a lot of people worrying about whether they can get more bandwidth than what is alloted. And
    it got me to wondering, how much bandwidth do other people's sites use a month? In the 6
    months I've had my site at trap17 (and the years at other places) I've never used more than
    90mb in a month until this month, when i put up a (low activity!) forum, and I am at 191mb right
    now. Nowhere near going over the 5120 limit. Does anyone ever get close? Or is this worry just
    wishful thinking? /laugh.gif' border='0' style='vertical-align:middle' alt='laugh.g....
  17. Christmas TV (Well sort of applies to UK only)
    (3)
    All those in the UK i.e BBC, ITV and Channel 4 and 5 viewers. What do you all think of the schedule
    so far? I think BBC have it well sorted, what with today being the best in a long while, having
    shown Cool Runnings , Armageddon and Halloween . They are three of my all time favourite films,
    some scenes in Armageddon particularly strike deep, even after having watched it countless times.
    I've also looked at the listings over Christmas in general and I'm well impressed compared to other
    years. What about other places? How's the Christmas line-up of movies over....
  18. Is There Something Else Than Our Material World?
    some sort of energy, pure good, god?? (10)
    If you look around yourself and things that happen you realize, that everything is in an unusual
    order (after fall comes winter, after day comes night,...). Is the source of this order purely and
    eniterly material or is there something else that puts things in order? I personaly think that
    there is something more than just our material world and the world of feelings (i mean the 5 major
    organs of sense and our emotions). I think that there is some sort of PURE GOOD outthere (that could
    also be called God or something else-it doesn't matter) and this pure good is t....
  19. Free Sig
    You want it? You take it. Sort of. (7)
    http://www.adesign.trap17.com/images/freesig.jpg If anyone wants this sig with their name on it,
    just tell me and I'll have it to you by monday or tuesday.....
  20. Yo...
    Sort of a request (11)
    Well, I should have the posts for it o.O but I lost my hosting because I couldn't get on
    computer at all barely and didnt get to tell an admin, well I said I wasn't gonna be as active
    but still, lost it, so if I need to get more up-to-date posts thats fine, I plan on posting more
    now, if not..which I doubt...I'll post the required info. Just thought I'd ask.....IDK if I
    should post this here or what, like for one this place is all new to me....allots changed @_@
    Anyways........
  21. What Sort Of Music Do You Listen To?
    (38)
    I enjoy almost all electronic music, especially DnB & Nu Skool Breaks. I don't
    like--*snicker*--Trance. What kinds of music do you listen to, produce, or spin?....
  22. Alphabetical File Sort Script
    (8)
    Okay, this script takes in an uploaded file from a form, adds it to the web server, and then it adds
    it to the correct alphabetical letter directory (ie. Active would go in the a directory). The only
    use I see for it would be for making it easier to find something when it is uploaded. This script
    takes two .php files: upload.php and upload-check.php. If you are going to use the script, you can
    rename those files to whatever you want. So, here's the script. Use it at your own discretion
    (as always). upload.php CODE <?php echo "<form action = &....

    1. Looking for xml2xml, sort, xml, xsl

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for xml2xml, sort, xml, xsl

*MORE FROM TRAP17.COM*
advertisement



Xml2xml (or Sort Xml) With Xsl?



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE