SitePoint Sponsor |
|
User Tag List
Results 76 to 93 of 93
Thread: Xsl Xslt
-
Jun 30, 2005, 09:57 #76
- Join Date
- Jan 2003
- Posts
- 5,748
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
One thing that I have noticed in due course, is that a lot of people who design an XSL stylesheet, have one XML tag to be depicted as one xHTML tag once transformed. So, what happens is that for example, they have 6 or so tags just to generate a single TABLE row yes?
What I tend to do on the other hand, is just have the one XML tag to depict a single TABLE row, and leave it to the stylesheet it's self, which is it's job at the end of the day, to generate the complete TABLE row.
I don't think the number of lines is as much a factor, as there are the number of templates to be matched, when compared. As, the number of templates increases, as does the amount of machine cycles, required to do the matching against the XML document.
In my view, reducing the amount of XML tags (which btw, only have to describe data, and not it's structure), you reduce the load, as I see it. On the point of XML as a container for data, and not it's structure, this is why I only use the one XML tag, and not half a dozen, as in what I said in my first paragraph.
Hope this makes some sense at least
-
Jul 1, 2005, 00:00 #77
If I understand correctly, you put all your data in the attributes of the xml-tag?
(I actually mix, depending on the use)
-
Jul 1, 2005, 02:59 #78
- Join Date
- Nov 2004
- Location
- Romania
- Posts
- 848
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
If I understand correctly, you put all your data in the attributes of the xml-tag?
For example:
Code:<event runat="client" when="onvalid"> <callback name="ExecOnValid"> <parameter>12</parameter> <parameter>This element is valid</parameter> </callback> </event>
-
Jul 1, 2005, 04:02 #79
Don't know...
Look at this example:
Code:<table> <row id="a" name="go" description="a game" price="10€" sold="23" /> <row id="b" name="go2" description="a game" price="10€" sold="23" /> <row id="c" name="go3" description="a game" price="10€" sold="23" /> </table>
Code:<table> <row> <id>a</id> <name>go</name> <description>a game</description> <price>10€</price> <sold>23</sold> </row> <row> <id>b</id> <name>go2</name> <description>a game</description> <price>10€</price> <sold>23</sold> </row> <row> <id>c</id> <name>go3</name> <description>a game</description> <price>10€</price> <sold>23</sold> </row> </table>
-
Jul 1, 2005, 04:57 #80
- Join Date
- Nov 2004
- Location
- Romania
- Posts
- 848
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yes, it depends from case to case, but with attributes you cannot add more complex values to a field.
Take for example:
Code:<table> <row id="123" date="2005-02-03" /> </table> versus <table> <row id="123"> <date> <year>2005</year> <month>02</month> <day>03</day> </date> </row> </table>
-
Jul 2, 2005, 00:40 #81
- Join Date
- Sep 2004
- Location
- Zagreb, Croatia
- Posts
- 830
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by bonefry
That being said, my personal approach is generally that the actual data goes into element values, while metadata, or data about data (like ids, names, certain types of dates etc), goes into attributes.
-
Jul 2, 2005, 07:38 #82
- Join Date
- Aug 2001
- Location
- London
- Posts
- 2,475
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I find it amazing how we always seem to derive back to the common questions on the topic of XSL. I have never seen any mention of security and XSL, actual implementations or approaches people take. Fundamentally why are people not taking advantage of seperating XML, XSL fragments out, and have thousand lines of a mixture of XSL and HTML? Do you honestly write a thousand lines of XSL or is this chunks & chunks of HTML embedded in XSL markup (Be realistic)?
- What is the purpose of XInclude? (There has never been a detailed mention of XInclude on this the forum)
-
Jul 2, 2005, 08:20 #83
- Join Date
- Jul 2004
- Location
- Netherlands
- Posts
- 672
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
What about wysiwyg, if you load a piece of html out the database will the xls template be ruined if there is a funky syntax in it? Or can you filter this out some way?
Go visit my site :-D you know you want to ;-)
www.mech7.net
-
Jul 4, 2005, 01:10 #84
- Join Date
- Nov 2004
- Location
- Romania
- Posts
- 848
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I find it amazing how we always seem to derive back to the common questions on the topic of XSL. I have never seen any mention of security and XSL, actual implementations or approaches people take. Fundamentally why are people not taking advantage of seperating XML, XSL fragments out, and have thousand lines of a mixture of XSL and HTML? Do you honestly write a thousand lines of XSL or is this chunks & chunks of HTML embedded in XSL markup (Be realistic)?
With PHP5 we are just discovering the technology.
-
Jul 4, 2005, 01:15 #85
- Join Date
- Nov 2004
- Location
- Romania
- Posts
- 848
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by pixelsoul
But if you really want to, there is a PHP interface to a handy utility called
HTML Tidy which can transform your html in valid xhtml.
-
Jul 4, 2005, 08:02 #86
- Join Date
- Jan 2005
- Location
- Belgium
- Posts
- 354
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
One of the pita's with php5 xsl is the fact that it's impossible to set the base_path...
So i'm forced to pass the path to the xsl file, or preg_replace the xsl:include href tags..
-
Jul 5, 2005, 10:07 #87
Originally Posted by pixelsoul
-
Jul 5, 2005, 10:43 #88
- Join Date
- May 2003
- Location
- virginia
- Posts
- 988
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Is there a way to use xslt with php4 and php5 without having to change your code? Sorry if this seems like a dumb question, but I've never really messed with it. If there were a way to have it so it worked on 4 and 5, I'd probably be more inclined to check it out.
- matt
-
Jul 5, 2005, 10:49 #89
- Join Date
- Jan 2002
- Location
- Canada
- Posts
- 6,364
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by mwmitchell
PHP Code:if (PHP_VERSION >= 5)
{
function XSLT($xml, $xsl)
{
$xslt = new XSLTProcessor();
$xslt->importStyleSheet(DOMDocument::load($xsl));
$out = $xslt->transformToXML(DOMDocument::load($xml));
return $out;
}
}
else
{
function XSLT($xml, $xsl)
{
$arguments = array(
'/_xml' => file_get_contents($xml),
'/_xsl' => file_get_contents($xsl)
);
$xsltproc = xslt_create();
$out = xslt_process($xsltproc, 'arg:/_xml', 'arg:/_xsl', null, $arguments);
xslt_free($xsltproc);
return $out;
}
}
- Nathan
-
Jul 13, 2005, 15:21 #90
- Join Date
- Jun 2003
- Location
- California
- Posts
- 98
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by cholmon
Originally Posted by Andrew-J2000
-
Jul 13, 2005, 16:11 #91
- Join Date
- Jul 2005
- Posts
- 194
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
XInclude, Xpath or Xlink support in the xml stuff for PHP4 or PHP5 would be nice. It would be cool to be able to link xml fragments into other xml.
-
Jul 13, 2005, 16:17 #92
- Join Date
- Nov 2004
- Location
- Romania
- Posts
- 848
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I don't know what XInclude is, but XPath is supported by PHP5 and XLink is not that usefull.
-
Jul 13, 2005, 16:23 #93
- Join Date
- Jul 2005
- Posts
- 194
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Well, I wanted to use XLink to link xml fragments without the other xml get cluttered.
Bookmarks