Jump to content

aalbetski

Members
  • Posts

    331
  • Joined

  • Last visited

Everything posted by aalbetski

  1. aalbetski

    CSS-pseudo

    <style type="text/css">a:link{color:#FF00FF}a:visited{color:#00FF00}a:hover{color:#FF0000}a:active{color:#0F0F0F}</style>
  2. try this, note the float:right;clear:right (swap left for right if desired) <html><img src="http://w3schools.invisionzone.com/style_images/w3sbanner.gif" style="float:right;clear:right;margin:10pt"><img src="http://w3schools.invisionzone.com/style_images/w3sbanner.gif" style="float:right;clear:right;margin:10pt">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse egestas ultricies pede. Phasellus suscipit blandit risus. Praesent nonummy. In erat. Duis nibh pede, accumsan eu, pulvinar et, volutpat vel, elit. Curabitur nec dui sed nunc congue tempus. Nulla ac dui ac libero fringilla nonummy. Maecenas ullamcorper sodales risus. Vivamus pretium dolor. Proin eu turpis. Phasellus ut mauris non nulla mattis luctus. Nunc porttitor dapibus sapien. In malesuada fermentum metus. Nulla egestas, tellus a vestibulum pharetra, nunc purus auctor lacus, ut semper purus ipsum eu velit. Praesent dui. Nulla accumsan turpis at erat.</html>
  3. doing a lttle google research, i found this: also
  4. Using recursion, this can be done with 1.1 XSLTThis XML <files> <file>\\someplace09\ak01\AK_RASTOFF\KJHGF46927_90D8BAE4D3124E0383EC647A13403DCE.WAV</file> <file>\\someplace15\MediaDir\somename\20061106\ABCDEF46927_80C49B8BC2D345DCB6F48F32E4D3B8AB_1H.WAV</file></files> This XSLT <xsl:template match="/"> <xsl:for-each select="//file"> <xsl:call-template name="GetFileName" /><hr/> </xsl:for-each> </xsl:template> <xsl:template name="GetFileName"> <xsl:param name="value" select="text()" /> <xsl:choose> <xsl:when test="contains($value,'\')"> <xsl:call-template name="GetFileName"> <xsl:with-param name="value" select="substring-after($value,'\')"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$value"/> </xsl:otherwise> </xsl:choose> </xsl:template> This is the result KJHGF46927_90D8BAE4D3124E0383EC647A13403DCE.WAV--------------------------------------------------------------------------------ABCDEF46927_80C49B8BC2D345DCB6F48F32E4D3B8AB_1H.WAV--------------------------------------------------------------------------------
  5. This is a somewhat complex solution (for the original question). There may be a simpler one. But nonetheless, its worth studying.This XML <items> <item-1>Item1</item-1> <elementA/> <item-code-1>123</item-code-1> <item-price-2>34.00</item-price-2> <elementB/> <item-code-2>456</item-code-2> <item-price-1>35.00</item-price-1> <elementC/> <item-2>Item2</item-2></items> This XSLT <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml"/> <xsl:template match="/"> <xsl:for-each select="//*[starts-with(text(),'Item')]"> <xsl:element name="Item"> <xsl:variable name="number" select="substring-after(name(),'-')" /> <xsl:attribute name="num"> <xsl:value-of select="$number" /> </xsl:attribute> <xsl:element name="Name"> <xsl:value-of select="concat('Item',$number)"/> </xsl:element> <xsl:element name="Code"> <xsl:value-of select="//*[contains(name(),concat('-code-',$number))]"/> </xsl:element> <xsl:element name="Price"> <xsl:value-of select="//*[contains(name(),concat('-price-',$number))]"/> </xsl:element> </xsl:element> </xsl:for-each> </xsl:template></xsl:stylesheet> This result <?xml version="1.0"?><Item num="1"> <Name>Item1</Name> <Code>123</Code> <Price>35.00</Price></Item><Item num="2"> <Name>Item2</Name> <Code>456</Code> <Price>34.00</Price></Item>
  6. Yes, and I had edited it to that effect, somehow it came back, sorry
  7. This works in SQL Server. Not sure about Access select department from items_sold where department not in (select department from items_sold where item_name = 'Geo positioning system') It uses a sub query to first determine all the departments that have sold a Geo positioning system and then the outer query excludes them
  8. I feel bad about not reading your question more thoroughly. The following code will dynamically create a mask for each value. Sorry for the quick reply beforeThis was the XML <nums> <num>1.6</num> <num>2638.643</num> <num>1234567.89</num> <num>00001.9</num> <num>23.934000</num> <num>0000037.3600000</num></nums> And the XSLT <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output method="html"/> <xsl:decimal-format name="myname" decimal-separator="," grouping-separator="."/> <xsl:variable name="numbers">123456789></xsl:variable> <xsl:variable name="zeros">000000000</xsl:variable> <xsl:template match="/" > <xsl:for-each select="//num"> <xsl:variable name="trailing" select="substring-after(.,'.')" /> <xsl:variable name="trailingmask"> <xsl:choose> <xsl:when test="string-length($trailing) <= 2"> <xsl:text>,00</xsl:text> </xsl:when> <xsl:otherwise> <xsl:value-of select="concat(',',translate($trailing,$numbers,$zeros))"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="leadingmask"> <xsl:call-template name="setmask"> <xsl:with-param name="count" select="1" /> <xsl:with-param name="length" select="string-length(substring-before(.,'.'))" /> </xsl:call-template> </xsl:variable> <xsl:value-of select="format-number(.,concat('$',$leadingmask,$trailingmask),'myname')"/> <hr/> </xsl:for-each> </xsl:template> <xsl:template name="setmask"> <xsl:param name="count" /> <xsl:param name="length" /> <xsl:text>0</xsl:text> <xsl:if test="($length - $count) mod 3 = 0 and $count != $length">.</xsl:if> <xsl:if test="$count < $length"> <xsl:call-template name="setmask"> <xsl:with-param name="count" select="$count + 1"/> <xsl:with-param name="length" select="$length" /> </xsl:call-template> </xsl:if> </xsl:template></xsl:stylesheet> The result: $1,60--------------------------------------------------------------------------------$2.638,643--------------------------------------------------------------------------------$1.234.567,89--------------------------------------------------------------------------------$00.001,90--------------------------------------------------------------------------------$23,934000--------------------------------------------------------------------------------$0.000.037,3600000--------------------------------------------------------------------------------
  9. a complete working example. <html> <script> function SetTDs() { var as = document.getElementsByTagName("td") for(i=0;i<as.length;i++) { as[i].style.padding="10px" } } </script> <body onload="SetTDs()"> <table border="1"> <tr> <td>This</td><td>will</td><td>all</td><td>be</td><td>the same</td> </tr> </table> </body></html>
  10. as I sais, it was off the top of my head. This WILL work: <table border="1"> <tr> <td>This</td><td>will</td><td>all</td><td>be</td><td>the same</td> </tr></table><script>var as = document.getElementsByTagName("td")for(i=0;i<as.length;i++){ as[i].style.padding="10px"}</script>
  11. try adding the style attributeas.style.cellPadding="0";Just off the top of my head
  12. This was covered in detail just two posts agoCheck out: Using XSLT to convert a XML file to a table in HTML ???
  13. This ability is built into XSLTdefine a decimal format as in this example:<xsl:decimal-format name="myname" decimal-separator="," grouping-separator="."/>and use it as in this example: <xsl:template match="/"> <xsl:value-of select="format-number(1.60,'$0.000,00','myname')"/></xsl:template
  14. I've been using 'Filezilla' and love it. Totally freehttp://filezilla.sourceforge.net/
  15. It can be removed and the data accessed without the node-set. As I said, modify as needed.I'm a big fan of recursion and always love to try and use it when I can. As you know, there are many ways to solve a problem. This is just another option.edited: I have revised the above code, removing the node-set references. Personally, I think that passing the node-set as a variable renders this as more resuable, but here it is for those who may want to see how it works. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:param name="CellsPerRow">3</xsl:param> <xsl:template match="/"> <xsl:call-template name="DoTable" /> </xsl:template> <xsl:template name="DoTable"> <xsl:if test="count(//item) > 0 "> <!-- nothing to do if empty --> <table border="1" cellspacing="0" cellpadding="0"> <!-- start the table here --> <xsl:call-template name="DoData"> <!-- Call the row builder for row one --> <xsl:with-param name="RowNumber">1</xsl:with-param> <!-- Start with row one --> <xsl:with-param name="TotalRows" select="ceiling(count(//attr) div $CellsPerRow) "/> <!-- Calculate the total number of rows that will be built --> </xsl:call-template> </table> </xsl:if> </xsl:template> <xsl:template name="DoData"> <xsl:param name="RowNumber"/> <!-- This routine is recursed into incrementing the row count each time --> <xsl:param name="TotalRows"/> <!-- value is constant, calculated by first caller --> <xsl:variable name="EndPos" select="$RowNumber * $CellsPerRow"/> <!-- This the end position of the node-set that we will position on --> <xsl:variable name="BegPos" select="$EndPos - $CellsPerRow + 1"/> <!-- This the beginning position of the node-set that we will position on, note that the end is calculated first --> <tr> <!-- add a row to the table --> <xsl:apply-templates select="//item[position() >= $BegPos and position() <= $EndPos]/attr" /> <!-- call the routine to add as many cells as needed based on the begin and end positions --> </tr> <xsl:if test="$RowNumber < $TotalRows"> <!-- If we have less rows than total, recurse into this routine and increment the row counter --> <xsl:call-template name="DoData"> <xsl:with-param name="RowNumber" select="$RowNumber + 1"/> <xsl:with-param name="TotalRows" select="$TotalRows" /> </xsl:call-template> </xsl:if> </xsl:template> <xsl:template match="attr"> <!-- Build each cell here --> <td><xsl:value-of select="." /></td> </xsl:template></xsl:stylesheet>
  16. The following XSLT code creates a dynamic HTML table. You define the number of columns that you want and it will create as many TRs as needed. This code use node-sets and recursion but is fairly straight forward. I am quite proud of this one as it had been my plague for years to do this. Feel free to adjust as needed. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0"> <xsl:param name="CellsPerRow">3</xsl:param> <xsl:template match="/"> <xsl:variable name="Data" select="//item" /> <!-- create a node-set of the data to display --> <xsl:call-template name="DoTable"> <xsl:with-param name="Data" select="$Data"/> </xsl:call-template> </xsl:template> <xsl:template name="DoTable"> <xsl:param name="Data"/> <xsl:if test="count(msxsl:node-set($Data)//attr) > 0 "> <!-- nothing to do if the node-set is empty --> <table border="1" cellspacing="0" cellpadding="0"> <!-- start the table here --> <xsl:call-template name="DoData"> <!-- Call the row builder for row one --> <xsl:with-param name="RowNumber">1</xsl:with-param> <!-- Start with row one --> <xsl:with-param name="TotalRows" select="ceiling(count(msxsl:node-set($Data)//attr) div $CellsPerRow) "/> <!-- Calculate the total number of rows that will be built --> <xsl:with-param name="Data" select="$Data"/> </xsl:call-template> </table> </xsl:if> </xsl:template> <xsl:template name="DoData"> <xsl:param name="RowNumber"/> <!-- This routine is recursed into incrementing the row count each time --> <xsl:param name="TotalRows"/> <!-- value is constant, calculated by first caller --> <xsl:param name="Data"/> <xsl:variable name="EndPos" select="$RowNumber * $CellsPerRow"/> <!-- This the end position of the node-set that we will position on --> <xsl:variable name="BegPos" select="$EndPos - $CellsPerRow + 1"/> <!-- This the beginning position of the node-set that we will position on, note that the end is calculated first --> <tr> <!-- add a row to the table --> <xsl:apply-templates select="msxsl:node-set($Data)[position() >= $BegPos and position() <= $EndPos]" /> <!-- call the routine to add as many cells as needed based on the begin and end positions --> </tr> <xsl:if test="$RowNumber < $TotalRows"> <!-- If we have less rows than total, recurse into this routine and increment the row counter --> <xsl:call-template name="DoData"> <xsl:with-param name="RowNumber" select="$RowNumber + 1"/> <xsl:with-param name="TotalRows" select="$TotalRows" /> <xsl:with-param name="Data" select="$Data"/> </xsl:call-template> </xsl:if> </xsl:template> <xsl:template match="attr"> <!-- Build each cell here --> <td><xsl:value-of select="." /></td> </xsl:template></xsl:stylesheet>
  17. try this: SELECT AVG(WorkspecPoint + ToolboxPoint + NearmissPoint) FROM Reportings WHERE Year = '2006' ORDER BY AVG(WorkspecPoint + ToolboxPoint + NearmissPoint) DESC Remember that when you use aggregate functions, you cannot use select *, you need to do a group by for each field that is not using an aggregate function, ex: SELECT AVG(WorkspecPoint + ToolboxPoint + NearmissPoint) ,YearFROM Reportings GROUP BY YearORDER BY Year DESC, AVG(WorkspecPoint + ToolboxPoint + NearmissPoint)
  18. In case you are interested, the following uses the 'Muenchian' method of selecting unique values. It does utilize keys and may be of interest just as another way to do the same thing <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output method="html"/><xsl:key name="Gender" match="Person" use="type"/><xsl:template match="/"><table border="1"> <tr> <td>Gender</td> <td>Vegetarian</td> <td>Non-Vegetarian</td> <td>Total</td> </tr> <xsl:for-each select="//Person[count(. | key('Gender', type)[1]) = 1]/type"> <xsl:variable name="gender" select="."/> <tr> <td><xsl:value-of select="$gender"/></td> <td><xsl:value-of select="count(//Person[type=$gender][vegetarian='True'])"/></td> <td><xsl:value-of select="count(//Person[type=$gender][vegetarian='False'])"/></td> <td><xsl:value-of select="count(//Person[type=$gender])"/></td> </tr> </xsl:for-each></table></xsl:template></xsl:stylesheet>
  19. you can unescape these characters:document.write(unescape("%F0%F2"))The unescape method returns a string value that contains the contents of charstring. All characters encoded with the %xx hexadecimal form are replaced by their ASCII character set equivalents.
  20. you can create this table with this: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html"/><xsl:template match="/"> <TABLE> <TR> <TD>Gender</TD> <TD>vegetarian</TD> <TD>Non-Vegetarian</TD> <TD>Total</TD> </TR> <TR> <TD>Male</TD> <TD><xsl:value-of select="count(//Person[type='Male'][vegetarian='True'])" /></TD> <TD><xsl:value-of select="count(//Person[type='Male'][vegetarian='False'])" /></TD> <TD><xsl:value-of select="count(//Person[type='Male'])" /></TD> </TR> <TR> <TD>Female</TD> <TD><xsl:value-of select="count(//Person[type='Female'][vegetarian='True'])" /></TD> <TD><xsl:value-of select="count(//Person[type='Female'][vegetarian='False'])" /></TD> <TD><xsl:value-of select="count(//Person[type='Female'])" /></TD> </TR> <TR> <TD>Child</TD> <TD><xsl:value-of select="count(//Person[type='Child'][vegetarian='True'])" /></TD> <TD><xsl:value-of select="count(//Person[type='Child'][vegetarian='False'])" /></TD> <TD><xsl:value-of select="count(//Person[type='Child'])" /></TD> </TR> </TABLE></xsl:template></xsl:stylesheet> If your requirements are more elaborate, than you will need to be more specific
  21. If all you want is to do is remove spaces, then replace the \s with a space var yourString = " this is your string\n "document.write(yourString.replace(/^ *| *$/g,"")) This will retain the newline character
  22. remove leading and trailing spaces:var yourString = " this is your string "yourString = yourString.replace(/^\s*|\s*$/g,"")
  23. you can include a target in your navigation page <a href="thislink.htm" target="right">Your Link</a>
  24. No, this is 1.1.I'll do a 2.0 one when I get some more time
  25. Here is an entire project in VB (written just for this) Imports System.XmlImports System.Xml.XslPublic Class WebForm1 Inherits System.Web.UI.Page#Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub Protected WithEvents Xml1 As System.Web.UI.WebControls.Xml 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub#End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim xmlSource As New XmlDocument Dim xslTrans As New XslTransform Dim xslArgs As New XsltArgumentList xmlSource.Load(Server.MapPath("cat.xml")) xslTrans.Load(Server.MapPath("cat.xsl")) xslArgs.AddParam("param1", "", "Hello") Me.Xml1.Document = xmlSource Me.Xml1.TransformArgumentList = xslArgs Me.Xml1.Transform() = xslTrans End SubEnd Class
×
×
  • Create New...