Jump to content

BlueDigit

Members
  • Content Count

    13
  • Joined

  • Last visited

Community Reputation

1 Neutral

About BlueDigit

  • Rank
    Newbie
  • Birthday 11/06/1994

Previous Fields

  • Languages
    XHTML, HTML 5 (partial), CSS 3 (partial), ECMAscript, jQuery, XML languages (partial)

Profile Information

  • Location
    u a creeper
  1. I asked about this problem, oh, two years ago, and never got any help on it. Basically gave up on the project. Now, though it's reared its ugly head again. Let's see if I get a response this time. So, have some example XML: <base> <parent> <child>blah blah blah</child> <abcd>efghijkl</abcd></parent> <parent> <child>oh my</child> <abcd>mnopqrstuv</abcd></parent> </base> Now, what I want to do, is use XSL to create, say, this— <div class="parent"> <p class="child" id="efghijkl"> blah blah blah </p></div> <div class="parent"> <p class="child" id="mnopqrstuv"> oh my </p></div> —from that XML. Here's an example of what I've got so far for XSL: <xsl:template match="/base"> <xsl:for-each select="parent"><div class="parent"> <p class="child" id="what is this i dont even"> <xsl:value-of select="./child"> </p></div></xsl:for-each> </xsl:template> So, does anyone have any idea at all as to how in the world I could get the content of <abcd> to be transformed into an id of <div class="child">? Just shoving an <xsl:value-of /> inside the quotation marks doesn't do anything but make browsers regurgitate an error into my face, as occurred in the past, and considering how long this tortured me before I finally relented and just abandoned the code the first time, I'm asking right off the bat.
  2. Hey, that made it workwait, why did that make it work? If I'm reading the script right, it's basically making an in-script variable called event, which contains a JavaScript reference to event, so that in-script references to event are referencing the JavaScript event, which is basically what it should have been doing in the first place.Tangent aside, I'm grateful for the help. It works in all the browsers I mentioned.
  3. Hello hello? Anybody willing to try and help?
  4. text-align won't do anything right now, since <a> fits itself to its content, leaving no space to center anything.word-spacing impacts the size of each space between words, and all the links in main-nav are only one word, so you won't see the effect. Were you thinking of letter-spacing?Edit: Hurr.
  5. I've gotten this tooltip to work just like I want it to—in Opera 10.53 and Internet Explorer 6, with the latter probably being more of a bad sign than a good one. Unfortunately, it bugs out in Firefox 3.0 and 3.6, K-Melon 1.5.3, and Flock 3.0, and I've got no idea why. If I remove the scroll-detection model block, then ‹asdf› appears, but only in its normal position, not where the cursor is. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html lang="en" dir="ltr" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><head> <title>test</title><script type="text/javascript"><!--var tooltip = function(a, b, c, d) { // ‹a› is the element id. // ‹b› is the display type. // ‹c› determines whether we're setting new text to be displayed or not. // ‹d› is either a number used to select from the genericText array // or a string of text. // If the browser is Internet Explorer, use its window scroll-detection model. if (navigator . appName == "Microsoft Internet Explorer") { var vertical = event . clientY + document . body . scrollTop; var horizontal = event . clientX + document . body . scrollLeft; } else if (navigator . appName != "Microsoft Internet Explorer") { var vertical = event . clientY + window . pageYOffset; var horizontal = event . clientX + window . pageXOffset; } var genericText = new Array();/* DESCRIPTION */ genericText[0] = "Explanation 1.";/* DESCRIPTION */ genericText[1] = "Explanation 2."/* DESCRIPTION */ genericText[2] = "Explanation 3." if (c == 0 || c == 1) { document . getElementById (a) . style . display = b; document . getElementById (a) . style . top = vertical + "px"; document . getElementById (a) . style . left = horizontal + 15 + "px"; if (c == 0) { document . getElementById (a) . innerHTML = d; } else if (c == 1) { document . getElementById (a) . innerHTML = genericText[d]; } } else if (c == 2) { document . getElementById (a) . style . top = vertical + "px"; document . getElementById (a) . style . left = horizontal + 15 + "px"; } else { alert ('lol error\n\n\ncheck dat script yo'); } }//--></script><style type="text/css">body { padding: 0px; margin: 0px; }div#asdf { display: none; float: right; position: absolute; background-color: #FF0000; }</style></head><body><span onmouseover="tooltip('asdf', 'inline', 1, 0);" onmousemove="tooltip('asdf', 'inline', 2, 0);" onmouseout="tooltip('asdf', 'none', 0, '');">TEST</span><div id="asdf">huh</div></body> Edit: fixed the doctype and added + "px" to the end of the parts controlling ‹asdf›'s top and left properties, but still no dice.
  6. 'K, then.XML:<?xml version="1.0" encoding="UTF-16"?><?xml-stylesheet type="text/xsl" href="C:\Documents and Settings\admin\My Documents\Web pages\test.xsl"?><base xmlns:xlink="http://www.w3.org/1999/xlink"><listUnit> <displayTitle>Test 1</displayTitle> <cssTitle>games</cssTitle> <ecmaTitle>games</ecmaTitle> <indexNumber>0</indexNumber> <content> <listGroup sorter="0"> <linkUnit> <linkText>Test Link 1</linkText> <linkTo>http://www.neopets.com/</linkTo> <sorter>0</sorter> </linkUnit> <linkUnit> <linkText>Test Link 3</linkText> <linkTo>http://www.neopets.com/</linkTo> <sorter>2</sorter> </linkUnit> <linkUnit> <linkText>Test Link 2</linkText> <linkTo>http://www.neopets.com/</linkTo> <sorter>1</sorter> </linkUnit> </listGroup> </content></listUnit><listUnit> <displayTitle>Test 2</displayTitle></listUnit></base> XSLT: <?xml version="1.0" encoding="UTF-16"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="4.0" encoding="UTF-16" omit-xml-declaration="no" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" media-type="text/xml" /> <xsl:param name="listUnitGroup" select="2" /> <xsl:param name="displayTitleGroup" /> <xsl:param name="cssTitleGroup" /> <xsl:param name="ecmaTitleGroup" /> <xsl:param name="linkGroup" /><xsl:template match="base"><html lang="en" dir="ltr" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Test Portal</title> <meta charset="UTF-16" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-16" /> <meta http-equiv="Date" content="22-01-2010" scheme="DD-MM-YYYY" /> <meta http-equiv="Last-Modified" content="22-01-2010" scheme="DD-MM-YYYY" /> <link href="…" type="text/css" rel="stylesheet" /> </head> <body> <div style="border: 5px solid #000000;"> <xsl:apply-templates select="listUnit[(position() mod $listUnitGroup) = 1]" /> </div> </body></html></xsl:template><xsl:template match="listUnit"> <xsl:variable name="id"> id="<xsl:value-of select="ecmaTitle" />" </xsl:variable> <xsl:variable name="headBgCon"> onmouseover="headBgCon('<xsl:value-of select="ecmaTitle" />', 1);" onmouseout="headBgCon('<xsl:value-of select="ecmaTitle" />', 2);" </xsl:variable> <xsl:variable name="boxConO"> onclick="boxCon('<xsl:value-of select="ecmaTitle" />Content', '<xsl:value-of select="ecmaTitle" />Header');" </xsl:variable> <xsl:variable name="boxConC"> onclick="boxCon('<xsl:value-of select="ecmaTitle" />Header', '<xsl:value-of select="ecmaTitle" />Content');" </xsl:variable> <xsl:for-each select=". | following-sibling::listUnit[position() < $listUnitGroup]"> <div class="ocBox_container"> <div class="ocBox_headerContain" <xsl:copy-of select="$id" />> <div class="ocBox_header" <xsl:copy-of select="$headBgCon" /> <xsl:copy-of select="$boxConO" />> <span style="font-weight: bold"><xsl:value-of select="displayTitle" /></span><br /> </div> </div> </div> </xsl:for-each></xsl:template></xsl:stylesheet> Ignore the unused elements and extra parameters, they're for after I get the basics working.
  7. Let's say you want to generate a set of divs like this— <div class="specialDiv" id="uniqueId1" onclick="clickFunction('uniqueId1', 'uniqueId2');" onmouseover="mouseFunction('uniqueId1', 'uniqueId2');" onmouseout="mouseFunction('uniqueId2', 'uniqueId1');">text</div><div class="specialDiv" id="uniqueId2" onclick="clickFunction('uniqueId2', 'uniqueId1');" onmouseover="mouseFunction('uniqueId2', 'uniqueId1');" onmouseout="mouseFunction('uniqueId1', 'uniqueId2');">text</div> —from an XML document that uses the same tags for both divs. I'm aware that this is possible to do (example), and I have managed to get it working that far, but the problem lies in something else: I can't get the attributes to carry over with the tags. Placing an XSLT tag (xsl:copy-of, xsl:value-of…) inside the div where the attributes would be causes an error, and using </> for the div turns the HTML to standard text. I've tried messing around with xsl:variable and xsl:element, too, without success on either attempts. What am I missing?
  8. Wow, thank you. =) I'll test your suggestions in a minute.Edit: and it works now! Again, thank you.
  9. I recently started working on making my own tool-tip script. It's gone well so far, but there are a few things that I need assistance with: <script type="text/javascript" language="Javascript"><!--//Attempting to create a tool tip... I wonder how this will go?//Thanks to astupidname @ W3Schools forum for the help on getting this thing to work.var toolTip = function(displayType, innerText) { var ttText = ["...", "It worked!", "EMPTY", "EMPTY", "EMPTY"]; document.getElementById('toolTipContain').style.display = displayType; if (innerText) { document.getElementById('toolTipText').innerHTML = ttText[innerText]; } }//--></script></head><body><div align="center"><div id="toolTipContain" onmouseover="toolTip('block');" onmouseout="toolTip2('none');"> <div class="toolTip" onmouseover="toolTip('block');" onmouseout="toolTip2('none');"> <div id="toolTipText"> </div> </div></div><span onmouseover="toolTip('block', 1);" onmouseout="toolTip('none', 0);">TEST</span> 1): this is tricky to explain. The way I've coded it, when you mouse over the element, it tells the script how to display #toolTipContain, and what variable to put into #toolTipText. Unfortunately, it's not including the variables -- rather, it's outputting a001 or a000, which are the variables' names. I've tried numerous variations, and now I'm just plain lost as to the solution. This has been resolved.2): is there any way to detect the edges of an element? I'm hoping there's some way to find the last vertical and horizontal pixel of an element (like the <p> tag which triggers the tool-tip, for instance), so I don't have to use onmousemove for positioning the divs.Before you say it, I know there are probably plenty of free-for-use tool-tip scripts out there. I'm attempting to make one because I'd like to test myself, but apparently I need a bit of guidance.Thank you for your time.
  10. You may also have Firefox "stuck" in Task Manager. Open it, go into "Processes," find Firefox, and end it.
  11. Unless I should just stop posting…One way I know of is to add this… body{text-align: center;} and then for anything that you don't want centered, add this: #name1, #name2, #name3{text-align: left;} Though, if you plan on having a lot of content where you'd have to repeat this process, it'd propably just easier to put #two within it's own holder <div>, like this:CSS: #two_holder{text-align: center;}#two{text-align: left;} HTML: <div id="two_holder"><div id="two"></div></div>
  12. Hmmm... Try this: body{margin: 0px;padding: 0px;} I think remember reading somewhere that Firefox just disregards the 0 entirely if it isn't specified what the 0 is. (I.E. 0px, 0cm, etc.)
  13. Hello, W3Schools Forum. I am BlueDigit.I started programming two years ago, but since then, my skills have become less than useful. [>_>;]So, I'm re-learning everything, starting with JavaScript. It's going well, so far.So, ermm… Hi.
×
×
  • Create New...