Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
So we have started our XSL transfer sheet and we have pulled in our XML data, we can see that in our Bindings panel and on the actual page itself. We have typed in a few placeholders. Show Type, the Date, Artist Name, Show Title and this is the information that we want to display. Now what's really happening here is that remember we formatted Show Type as a Heading 1 and we formatted the line underneath that as a Heading 2. So we are passing along information to XSL and tell it how we want our XML information to display. So the resulting output of this transfer will be XHTML and we have finished up explaining to it how this XHTL should be formatted.
So now we are ready to go ahead and bind the data from the external XML file into our XHTML element. So let's go ahead and start doing that. So I am going to highlight the text Show Type and I am going to go over to my Bindings panel and I am going to find the element that corresponds to that. Now I don't want to click on the Show Type tag. I want to actually click on the Type Attribute for the Show Type tag. I will double-click on that and what happens is Show Type was replaced with the actual XPath syntax that describes the location of that data. So we are going to see where the gallery shows Show Type and then the Type Attribute. Notice also that it's surrounded by curly braces. Well, that's very, very simple to do. So I am going to highlight date, find the Date attribute underneath Show, double-click on that. I will highlight artist name and find the Artist Name attribute and double-click that. I will find Show Title, go over to the actual Show Name attribute and I would double-click that as well.
Now you can also drag and drop if double-clicking isn't working for you. So I am going to highlight the words description, I will find the description tag and I will actually drag that over my highlighted text and I can see that that's replaced as well. So whichever method you like, whether you like double-clicking, dragging and dropping, whatever works for you. So I am going to highlight painting name and I will go to my painting tag and again I will double-click the Name attribute and it will add that as well. So I am going to save the file. We are almost done with our initial transformation, but we have got one more element that we haven't placed on the page yet and that we don't have a placeholder for it, and that's the image. So we have a thumbnail image that's going to show up next to the description of the show. But we don't have a placeholder for that. We certainly could have placed one. Dreamweaver does an image placeholder, but it's easier for us just go ahead and insert the image on the page.
So what I am going to do is select my description and hit the left arrow key here and that's going to place my cursor immediately beside that particular information, and I will go up to my Common Objects. In my Common Objects, I am going to grab the Images menu and I will choose image and we will insert an image on the page. Now instead of browsing for an image, this time I am going to go down to the bottom of this dialog box and click on the Data Sources button. Now on the PC you would find the Data Source Radio button at the top of the Import to Select Image Source dialog box. So I will choose Data Sources and from my data source, I am going to scroll down until I find image > url. So I will select that, click OK and my Alt text comes up. This really doesn't have anything to do with XSL or Binding; this is all about accessibility. So I am just going to type in the text placeholder, because I do want Alt text, but there is no way here to actually bind this to my XML data in this dialog box. We will just click OK and now we have an icon over there just beside description of our dynamic image. So anytime you see that little logo with a lining bulb that means there is dynamic information going on.
Make sure that it's selected and switch over to Code View and let's see what it actually did. So we can see that our image source attribute has been changed and it contains our XPath information. So if I highlight my placeholder for my Alt text, I can go over to my Bindings panel and find the Image Title attribute because that's going to reflect our Alt text and I am just going to drag that over the placeholder and replace it. Now when you do that, be very careful, because you are highlighting code and you are replacing that code, you want to make sure that you have got exactly what you need highlighted and you want to make sure that the results are what you expect.
To that end, sometimes when you place this XPath data on the page, Dreamweaver doesn't always place the curly braces the way it's supposed to. So right before gallery shows, I am going to type in and opening curly brace, directly after it, I am going to type in a closing curly brace. So we will go ahead and save that. Now if I click back into Design View our initial set up is pretty much done. So we have saved our file and let's go ahead and preview that in our browser. When you preview this in the browser, it's actually previewing this using a temporary file. XSL transformation is by no means complete, but we can see what's happening. It says upcomingShows, there is the Date and name of the artist, and the Show itself. We can see a thumbnail image, a description of the text, a description of the Show and then Featured Work. So it's looking more and more like we need it to look.
So I am going to close this and we have a little bit of a problem here, and the problem is we want to show more than just the first show. Thee are four shows, we want all four to display. So in our next exercise we will take a look at creating repeating regions inside your XSL transfer sheets.
Get unlimited access to all courses for just $25/month.Become a member