Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

  • 6 odgovora
  • 5.746 pregleda

Najnovija ↓

XML Transform to XML with XSL 19.04.2006. u 15:01 · pre 250 meseci
izmenjeno 2 puta, poslednji put dejanos 19.04.2006. u 15:05
  1. dejanos19.04.2006. u 15:05zapis iz teksta poruke
  2. dejanos19.04.2006. u 15:01zapis iz teksta poruke
#1
Pozdrav svima!

Imam xml file:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="contacts.xsl"?>

<contacts>
<contact id="1">
<ime>Ime 1</ime>
<prezime>Prezime 1</prezime>
</contact>
<contact id="2">
<ime>Ime 2</ime>
<prezime>Prezime 2</prezime>
</contact>
</contacts>

I preko xsl-a teba da ga transformisem u slican xml file:
<contacts>
<contact>
<userID>1</userID>
<firstName>Ime 1</firstName>
<lastName>Prezime 1</lastName>
</contact>
<contact>
<userID>2</userID>
<firstName>Ime 2</firstName>
<lastName>Prezime 2</lastName>
</contact>
</contacts>

I napravio sam xsl file:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<contacts>
<xsl:apply-templates/>
</contacts>
</xsl:template>

<xsl:template match="contacts">
<xsl:for-each select="contact">
<contact>
<userID><xsl:value-of select="@id"/></userID>
<firstName><xsl:value-of select="ime"/></firstName>
<lastName><xsl:value-of select="prezime"/></lastName>
</contact>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

I kako sad da ja to pokrenem? :) Mislim da treba ovako da napisem xsl file ali ne znam kako sad da ja to pokrenem pa da dobijem neki novi xml file koji izgleda onako kao sto sam naveo da treba da izgleda.

Pozdrav
Potpis
Ostojic Dejan
Re: XML Transform to XML with XSL 19.04.2006. u 15:21 · pre 250 meseci #2
Treba ti neki XSLT procesor kao što je npr SAXON. A možeš da koristiš i običan web browser sa ugrađenom XSLT podrškom.
Potpis
IOCC
Re: XML Transform to XML with XSL 19.04.2006. u 17:15 · pre 250 meseci #4
Ako koristis integrisanu podrsku web browser-a, npr. IE-ov MSXML, a pri tome ne zelis da rezultat renderujes unutar prozora browser-a, moras pribeci triku:
npr. http://www.cranesoftwrights.com/resources/debugmsxml/
XML fajlu dodeli .xml ekstenziju.
XSL fajlu dodeli .xsl ekstenziju.
Napravi potreban .bat i .js fajl.
Pokreni .bat i prosledi imena XML fajla, XSL fajla, i ime izlanog fajla.
Potpis
O_o
Re: XML Transform to XML with XSL 27.04.2006. u 23:06 · pre 249 meseci #6
ili altova xmlspy
odlican je , toplo ga preporucujem
Potpis
code je haiku
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme