Jump to content


  • Posts

  • Joined

  • Last visited

Contact Methods

  • Website URL
  • ICQ

Profile Information

  • Interests
    Lau Gar Kung Fu, Snowboarding, Computer Games, My Wife

dooberry's Achievements


Member (2/7)



  1. Going on Boen's (aka XML Sifu) reply I think I can see what's happening here and make a bit more sense of the post.I think that you are submitting an invalid parameter.The first statement (as Boen said) selects all of the child elements with the value A.I have no knowledge of PHP whatsoever so disregard this if it sounds like b*ll*cks, but surely the second statement should be more like:for $d in doc("blabla.xml")//tag/tag2[tagsent/tagsent2=A]to mirror the effects of the first one (I'm assuming that XPATH syntax will work here)D
  2. I've done something similar but not using images.If you want to change the side menu based on the top menu, you need something to refresh the page after you've re-transformed it.What I would do is put something like this into effect:Have one xml element in the image document which stores the menu selection that the user clicked (i.e. Blue, Pink, Yellow etc). <images><portrait type="blue" image="images/blue1.jpg" thumb="/images/thumbs/blue1.jpg" description="This is blue " /><portrait type="blue" image="images/blue2.jpg" thumb="/images/thumbs/blue2.jpg" description="This is also blue! " /><portrait type="yellow" image="images/yellow1.jpg" thumb="/images/thumbs/yellow1.jpg" description="This is yellow" /><portrait type="pink" image="images/pink1.jpg" thumb="/images/thumbs/pink1.jpg" description="This is a pink color" /><portrait type="pink" image="images/pink2.jpg" thumb="/images/thumbs/pink2.jpg" description="This is also a pink color" />[b]<current>*</current>[/b]</images> You can then use the content of this document in the xsl sheet by using the following xsl <input type="button" onclick="Reloadpage('pink')">Pinks</input><xsl:variable name="selection" value-of select="current" /><xsl:for-each select="/images/portrait[@type=$selection]" ><image onclick="document.getElementById(mainimage).src=this.image"><xsl:attribute name="src"><xsl:value-of select="@thumb" /></xsl:attribute><xsl:attribute name="image"><xsl:value-of select="@image" /></xsl:attribute></image><br /></xsl:for-each> Then you write script to update the html property of the div/frame that you are using: <script type="text/javascript">var xmldoc, xsldocxmldoc = new ActiveXObject("Microsoft.XMLDOM")xsldoc = new ActiveXObject("Microsoft.XMLDOM")xmldoc.load("images.xml")xmldoc.async = "false"xsldoc.load("images.xsl")xsldoc.async = "false"function Reloadpage(itemvalue){xmldoc.selectSingleNode("current").text = itemvaluexmldoc.save()document.clear()document.write(xmldoc.transformNode(xsldoc))}</script> Ok, it's really hot and I'm exhausted!!If this doesn't help the let me know and I'll see what I can do.D
  3. The above example works great, but you could go one step further.If you don't want to have to know the value of categoryid you could just change the Where clause to WHERE categories.categoryname = 'Golf' OR categories.categoryname ='Male' This is useful if the id is system generated for each category.
  4. dooberry

    select sum()...

    If you only want the totals, then try this (based on your example above) SELECT Fname, Lname, sum(trns) as totalFROM tableGROUP BY Fname, Lname This will also work across a valid join between two tables.
  5. You don't need to write the ALTER table statement twice, you can separate the fields with commas: ALTER TABLE dbname.dbo.tablenameADD columnA bit Default 0 Not Null, columnB bit Default 0 Not Null
  6. Remove "WHERE read=false".Also try this instead: SELECT account.address, count(email.id)FROM accounts INNER JOIN emails on accounts.account = emails.account This is much more straightforward because the subviews you have written are not needed. Only use views instead of tables in a JOIN clause to condense or transform the information that you need to look at - this usually is a technique you would use where you have a table with many fields and you need to minimise the amount of network traffic / server load by reducing the data retrieved.
  7. dooberry

    Unique ID

    Err, applying the relational database principle (XML is a similar beast after all) to this, isn't the whole point of a unique id to be *ahem* a unique id?Why do you need to add data with a null id and how on earth are you going to identify it when you try and look for it?If the second table is effectively on the "many" end of the relationship in the unique id then fair enough because that means that it doesn't have a "parent" record, and yes you would have to allow dbnull.The alternative is that you populate the unique-id automatically so that you don't have to worry about the null value issue.
  8. I agree with Boen (who is now my involuntary mentor!), but what I'd say is if you want to show the xml using your own html, dont use data islands and instead copy your html into your style sheet and replace the XML data links with <xsl:for-each>.for example: <table><thead><tr align="left"><th>Steam_id</th><th>Name</th><th>Kills</th><th>Deaths</th><th>Suicides</th><th>Headshots</th><th>Kd_ratio</th></tr></thead><xsl:for-each select="User"><tr align="left" onclick="testclick(this)"><td><xsl:value-of select="steam_id" /></td><td><xsl:value-of select="name" /></td><td><xsl:value-of select="kills" /></td><td><xsl:value-of select="deaths" /></td><td><xsl:value-of select="suicides" /></td><td><xsl:value-of select="headshots" /></td><td><xsl:value-of select="kd_ratio" /></td></tr></xsl:for-each></table> Then all you need to do is apply the stylesheet, which is something you can do in either XMLDOM (javascript) or within the XML file itself.You seriously need to look at the XSL tutorial first though - it's great and you can see where you've gone wrong when you try stuff out.
  9. dooberry

    xquery help

    get rid of the speechmarks around pubdate: <xsl:value-of select="substring(pubDate,1,15)" /> If you use speechmarks inside an xpath expression/function then xpath thinks that you have put a value between the speechmarks, not the name of the element you need to look at.To see what I mean try: <xsl:value-of select="pubDate" /> and then try: <xsl:value-of select="'pubDate'" />
  10. I've used this to another end as well now.Instead of "jumping" between nodes based on a user entry, I can also use this to identify where key values have not been entered: <xsl:choose><xsl:when test="item_qty"> <xsl:input id="qty"> <xsl:attribute name="value"> <xsl:value-of select="item_qty" /> <xsl:attribute/> </xsl:input></xsl:when><xsl:otherwise>You have not entered the quantity.</xsl:otherwise></xsl:choose> This is a useful way to eliminate schema (because I don't have the facilities to use them!).
  11. dooberry

    CSS in XSL

    Please refer to this topic for further details:bang your head long enough and you can break through the wall!!
  12. dooberry


    This might work, but I think I know another way round it.The innerHTML property is still allocating the class attribute, so I can move the class definition out of the XSL sheet and into the 'home page'.This should allow the home page to understand the style required when the class is allocated.edit: It worked - I was stuck in my box again!Thanks for all your help guys - sorry to be a nuisance.Also if anyone is reading this post looking to change the text content of a div dynamically you can do it this way: document.getElementById('divelementid').removeChild(document.getElementById('divelementid').childNodes[0])document.getElementById('divelementid').appendChild(document.createTextNode(textcontent)) Well shizzle my nizzle!
  13. dooberry


    Ok,I have an idea using an iframe.I can write to the content of the iframe, but is there a way of calling script functions which are outside of the document in the iframe? If this works, then the same should be able to be done with frames.I need to be able to manipulate a global variable which stays as the content of the iframe changes any ideas?
  14. dooberry


    Yeah, you're right and that is the problem.What I'm trying to do is find a property (Javascript type property) within the div element that has a write() method.If I can do this, then I can change the content dynamically and not have things like script and styles stripped out of the html inside the div element.what I am looking to be able to do is something like: document.getElementById("displaydiv").whateverthecontentobjectis.write(myxmlddocument.transformNode(thexsltransformdocument)) I know that this can't be done using the innerHTML property because I've tried it and it will only add HTML elements, not style or script elements.The reason I have to do it this way is because the styles are allocated dynamically by the XSL sheets, and storing them in the main webpage is not an option.If you know of such a property then that would be great.Dooberry sits rocking in the corner.EDIT: PS My name's Dan too!
  15. dooberry


    Guys,I'm having real trouble here and I've resorted to spamming a little (my profuse apologies!).Can anyone tell me how to dynamically write content to a div element.I've tried using the InnerHTML property, but that cleans out functional elements such as script and style.It is not possible to change the outerHTML property dynamically because Explorer doesn't allow it.I've had this problem before with table cells and frames are not suitable for the project.I thought there might be something within the div element like div.body.document, but I can't find anything.Please help!Dooberry
  • Create New...