Profilo di CharlesCharlie's PlaceFotoBlogElenchiAltro ![]() | Guida |
|
26 dicembre Homework assignment- Answer now posted in Strategy FilesI just posted the answer for the Homework for last weeks class. The assignment was to create a comma separated list of multiple authors if there were more than one author per article. I modified the Articles.xslt file to apply a match to "Author" and then check to see if there more than the current one. If there is it adds a comma and a space. Question: How would you do the same thing that I did using a for loop instead? Hint, you wouldn't need an additional "apply template". New stuff for studentsFYI everyone, as promised I added the answers to the CSS questions I posted last month. As you can tell the questions are rather open ended. That's deliberate so that I can hear a little bit about how the interviewee walks mentally through the question. I also added a CSS coding standards doc to the class folder in both .doc format and .mht which is viewable in a browser. I hope everyone had a great Holiday :-) 14 dicembre CSS and Javascript questions-Posted Potential Answers!Here are some questions an interviewer might ask- class feel free to add comments and questions that you've been asked as well!
CSS Interview Questions 1. What are the different types of CSS selectors? #ID .Class and Element Name selectors 2. Describe to me the different ways in which CSS can be used to control flow and layout in a page. You may use the : 1. Normal document flow (static left to right - top to bottom) with margins, widths, floats and padding. 2. Absolute positioning where the element selected get its position reference from the nearest positioned parent element or the page itself. Elements may be stacked on top of one another. 3. relative positioning where the element selected get it's position reference from either it's previous sibling element or the nearest positioned parent element (or the page itself) 3. Describe to me the differences between absolute and relative positioning See question 2 above 4. What is a float and how do you restore normal document flow once a float has been set. You may use a clear property on a subsequent element to allow the page to resume the normal element layout and flow 5. What is selector specificity? Specificity is used by the CSS rendering engine to determine which property has precedence when there are conflicts between rules. The more specific selectors a rule uses the more likely it is that that rule will override another that it directly conflicts with. 6. What are the approximate specificity weights for the different selectors? #id = 100 .class = 10 element name = 1 5. If you have a common css file for several sites that sets a width on an div element using an id describe what selectors you could use to override this rule. Assume that the overriding rule would be placed in a latter file. If the html looked like this:
<div id="containerDiv">
<div id="myDiv" class="someClass">
<span>Hello</span>
</div>
</div>
and the original CSS looked like this:
#myDiv
{
color:green;
}
I have several choices if I want to override the green color for the word "Hello" on specific pages. 1. The high specificity weight solution: #containerDiv #myDiv.someClass SPAN
{
color:red;
}
2. The simpler solution:
#myDiv SPAN
{
color:red;
}
JavaScript/DOM Questions
First you need to get a reference to the DIV (assuming it had an ID) using the DOM method document.getElementById("someDiv"). Then using that reference you could retrieve a collection of spans in that div by using the getElementsByTagName("SPAN") method against whatever variable you had assigned to someDiv. You can then loop through that collection with a for loop and for each element (usually using the "i" variable) you could set the .className property to whatever you want. 07 dicembre Homework solution for Thurs. ClassI just uploaded the solution for the last assignment. This was adding a "add to cart" button that displayed the item id. I added back in the link from the xml doc to the xslt to make displaying the results a little easier. After adding the xsl element "button" and the "onclick" attribute I then added stylesheet rules for the button and a height property for the item list. Good luck! I hope everyone succeeds in getting this to work :-) 05 dicembre XSLT Homework solutionI've added new versions of both the xml and xslt files containing a possible solution to the homework. The problem was adding thumbnail album images to our cd descriptions. Here are the steps I used.
1. After creating an images folder in the same location as the xml and xslt files I downloaded appropriately sized album cover images (approx 118 x 118). In the CD xml file I added a <ImgThumb> element to the <CD> node containing the image name of the album image for that CD.
2. In the xslt file inside the cd for-each loop just after the xsl:sorts I added a xsl:element named "img".
3. I gave that element an xsl:attribute named "src"
4. The text inside the src attribute is "images/" followed by the xsl:value-of selected for "ImgThumb".
5. This outputs html that looks like this: <img src="images/image1.jpg"/>
6. I then used stylesheets to float the image right and the button left.
7. I also added some width to the cdlist list items so that the subheads and the rest of the data didn't wrap weirdly.
Thats about it! See everyone in class tommorrow :-) 01 dicembre XSLT Solution for Fridays ClassFor those of you that are paying attention :-) I've uploaded a solution to the CDCatalog homework in my shared folder "Strategy Classes" If you need it... |
|
|