Creating and using a Static XML Data Source
This is an open discussion with 14 replies, filed under General.
Search
@jason_slack - look over the following tutorials from @jonasd.
@bzerangue - I am reading and I get to part 3 with data sources. I can see my data when I do a ?debug=xml on the page I want to use the data on, but I get an error that is:
XSLTProcessor::importStylesheet(): compilation error: file /Volumes/WebServer/symphony/workspace/utilities/get-projects.xsl line 13 element with-param
it looks like the data is in this format:
http://pastie.org/2165507
and I created a get-projects.xsl that is:
http://pastie.org/2165508
and I tried this as well:
http://pastie.org/2165518
With this second one I dont get errors, but I dont see the data (
Can you help me understand?
Why can't I use my own custom simple XML file and just read from that. It seems like a lot less work that doing what I did in the tutorial.
@jason_stack - you can only use a xsl:with-param inside of xsl:apply-templates and xsl:call-template. It would be a great benefit to you to run through the XSLT basics, before going forward.
@bzerangue - I was reading that as you posted. <xsl:value-of select="title"/>
Although I still need to see my error of not having data displayed.
Also, instead of using...
<xsl:with-param name="title" select="title" />
You'll want to use
<xsl:value-of select="title" />
@bzerangue - OK, I think I have this right but I am still not seeing the data. How can I better diagnose what is going on so I can learn the mistake?
Please post your entire xsl and XML.
Also, watch this screencast that @Allen did on how to use xsl:apply-templates.
The entire ?debug=xml: http://pastie.org/2165699
You can see at line 112 the <projects>
element, I want the <name>
value...i.e 6Colors.
Yes, I changed from using title
like I previously was.
My .xsl: http://pastie.org/2165705
Thanks for the video, starting it now.
Do you have a tutorial on Static XML files as data sources?
What is the app that Allen uses in the video, that would be really helpful!
The app that Allen is Using in that video is TestXSLT,
Watch the video. It will answer your question on why it's not working.
Please read through the XSLT basics before going forward. You need to understand how to use the XSLT language first, then you can solve your templating issues.
@bzerangue - Thank for everything so far. I really appreciate it. I will watch the video in depth first thing in the morning and go through the XSLT tutorial at W3C tomorrow again as well. I really want to get up to speed and learn! I will update tomorrow.
@bzerangue - OK, the tutorial was very awesome and everything works in the TestXSLT app, but I am still not sure how to use a Static XML datasource in my code. I created the datasource (named Projects) and a get-projects.xsl
utility that contains my XSLT. I Import the get-projects.xsl
It occurs to me that I dont know how to associate my Projects
datasource into where I want to use it and apply the template to it.
Can you help me understand?
Are you attaching the data source to the page?
Create an account or sign in to comment.
I am learning Symphony and with no better way than to build myself a site.
I want to display a list of projects that I work on so I created a new Static XML data source called "Projects" and I used the following XML:
http://pastie.org/2165225
I will update to add new projects as needed in the future.
I am trying to display a list of my projects on my page doing:
http://pastie.org/2165228
That doesn't display anything.
I thought that I needed to create an .xsl so I tried:
http://pastie.org/2165221
and
http://pastie.org/2165296
Still it does not display anything.
I am obviously missing a core concept. I would love to know what I am missing and input on how I can fix my problem.