Jump to content

Loriot

Members
  • Posts

    26
  • Joined

  • Last visited

Everything posted by Loriot

  1. Hi there,I did the same thing and it works perefctly alright without blanks. But I have packed all that in a table structure and have the pics i a row in a cell. Maybe that helps... <td><xsl:variable name="link"><xsl:for-each select="File_Filename0"/></xsl:variable><a href="{$link}"><img border="0" align="middle" src="First.bmp"/></a><a href="{$link}"><img border="0" align="middle" src="Second.bmp"/></a><a href="{$link}"><img border="0" align="middle" src="Third.bmp"/></a></td>
  2. Hi all, sorry for being such a massiv questioner right now but I got one more problem and maybe I get from you one more solution. I have a stylesheet that transforms some xml data and inserts at a certain position another xml file content. Looks like that in the place: <xsl:copy-of select="."/> <xsl:copy-of select="document('SomeName.xml')"/> Now I would like to replace the konkret filename with a variable så that i can fetch the filename from the data in the transformed main.xml I tried that way, but it didn't work out: <xsl:variable name="Somename" select="FilenameValue"/> <xsl:copy-of select="."/> <xsl:copy-of select="document('$SomeName')"/></xsl:variable>
  3. Thanx boen robot! It works. You made my day!
  4. Hi all,I got a very nice little extra template that transforms a millisecond value to hh:mm:ss. But now I found out that it failes in one special case: If I have something that is 1min 59sec and 990 msec, than I get 1:60 instead of 2 min. Somebody out there that knows how to transform that correctly?My calltemplate: <xsl:decimal-format name="european" decimal-separator=","/><xsl:template name="processLength"> <xsl:param name="milliseconds"/> <xsl:variable name="hours" select="floor($milliseconds div (1000*3600))"/> <xsl:variable name="minutes" select="floor(($milliseconds mod (1000*3600)) div (1000*60))"/> <xsl:variable name="seconds" select="($milliseconds mod (1000*60)) div 1000"/><xsl:value-of select="concat(format-number($hours, '#00'), ':',format-number($minutes, '00'), ':', format-number($seconds, '00', 'european'))"/></xsl:template> Help would be thankfully taken!
  5. Hi,I found out about it. Prosessing is done by msxml parser and this will always answer with UTF-16 np matter what you really do have. The msxml parser is not able to transform encoding mode. So I found at least another solution and feed now UTF-8 already into the parser. the funny thing is, that you definitely have to write the <?xml version="1.0" encoding="UTF-8"?> header inn by yourself. If you do not set <omit-xml-declaration="yes"> you will always get a header og UTF-16 no matter what the file really is. This is really odd!!But if anybody is hanging around in that forum who knows some scripting or so I can use to change encodings in one go with xsl-transformations I am still curious to know.Thanx so far!!
  6. Hi all, I got a little problem with encoding. I try to transform with XSL stylesheet one XML into another. From the input side I can get either UTF-16 or ANSI. On the output I must have UTF-8 But whatever I tried:The coding stays as I get it in. What's wrong?? Here is the last version I tried. <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version= "1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="UTF-8" media-type ="application/xml" omit-xml-declaration="yes"/> Any help is appreciated!Loriot
  7. Got a little further now. You were right, I didn't need the match/lavel3. So this is where I am now to get a proper basis:Stylesheet <?xml version="1.0" encoding="UTF-16"?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:apply-templates/> <xsl:copy-of select="."/> <xsl:copy-of select="document('second.xml')"/></xsl:template></xsl:stylesheet> Result: <Level1> <Level2> <Level3> </Level3> </Level2></Level1><!--up til here all from first xml--><!---from here added info from second xml--> <Level2> <Level3> <Tag1>x</Tag1> <Tag2>x</Tag2> <Tag3>x</Tag3> </Level3> </Level2> I can filter the second.xml that I just get the Level3 and Tag info.But how do I now tell the stylesheet, that I want to replace the Level3 section with the content from second.xml?Any suggestions?RegardsLoriot
  8. Hi, I have quite a similar problem right now and couldn't solv it only with the help of the topic so far. I have 2 xml files og unidentical level depthfirst: <Level1> <Level2> <Level3> </Level3> </Level2></Level1> second: <Level2> <Level3> <Tag1>x</Tag1> <Tag2>x</Tag2> <Tag3>x</Tag3> </Level3> </Level2> Now I want to keep the structure and content of the first xml file but replace level3 and add the tag contents from second xml. I don't get it. Tried this as last version: <?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <Level1> <xsl:apply-templates/> <Level2> <xsl:copy-of select="."/> <Level3> <xsl:copy-of select="document('second.xml')/Level1/Level2/Level3"/> </Level3> </Level2> </Level1> </xsl:template> <xsl:template match="/Level3"> </xsl:template></xsl:stylesheet> I just get prosessed the first xml. What's wrong? Tipps appreciated!Loriot
  9. You are a genius and made my day!!! That works!Thanks aalbetski!!
  10. Hi Boen, I am using som special prosessor implementet in a microsoft based professional radio software. You won't know it. So it seems that I fail this time. Thanks anyway so far.I was thinking round my problem.Functions that could help me were-extract some substring between signsor-turn round string and substring beforor-take substring after last slash (or whatever I translate the slashes to)or-devide value in several values at slashes, then I could continue with last value afterwardsor?I am clueless on all this. But maybe one has an idea?? Maybe there is some java solution I havn't thought of, because I am no java prof.Any hint is appriciated!Loriot
  11. Hi helpful,unfortunately I came to the same point as you, taht I can't use the reverse function (no 2.x parser...). My filenames look like that:\\someplace09\ak01\AK_RASTOFF\KJHGF46927_90D8BAE4D3124E0383EC647A13403DCE.WAV or like that\\someplace15\MediaDir\somename\20061106\ABCDEF46927_80C49B8BC2D345DCB6F48F32E4D3B8AB_1H.WAVand I need to extract just the filenames:KJHGF46927_90D8BAE4D3124E0383EC647A13403DCE.WAVABCDEF46927_80C49B8BC2D345DCB6F48F32E4D3B8AB_1H.WAVI go checking out the tokenize function. Never tried that before. Maybe it helps. Thanks for this first hint.Loriot....tokenize doesn't work out for me. Could you probably give me an example?<xsl:value-of select="tokenize(File_Filename0,'\/')/> leads to an error message that tokenize is an unknown function?
  12. Hi helpful people out there. I am trying to extract the filname out of different pathes. As I don't know the length an number of slashes in the path, I tried to turn it round, take the backwards part until the first slash and turn the result one more time, but it doesn't work like that: <xsl:value-of select="reverse(substring-before(reverse(File_Filename0),'/'))"/> Maybe someone here has some better idea how I solve that???RegardsLoriot
  13. hihi, now I found out on my own. The solution is the floor function.So now I got working code with that:</xsl:template><xsl:decimal-format name="european" decimal-separator=","/><xsl:template name="processLength"> <xsl:param name="milliseconds"/> <xsl:variable name="minutes" select=" floor($milliseconds div 60000)"/> <xsl:variable name="seconds" select="($milliseconds mod (1000*60)) div 1000"/> <xsl:value-of select="concat(format-number($minutes, '00'), ':', format-number($seconds, '00', 'european'))"/></xsl:template>
  14. Hi all,I have a little wrong working transformation and would appriciate some help from you: For a value coming in Milliseconds I try to transform it to minutes:seconds.milliseconds with the following call-template: <xsl:template name="processLength"> <xsl:param name="milliseconds"/> <xsl:variable name="minutes" select=" ($milliseconds div 60000)"/> <xsl:variable name="seconds" select="($milliseconds mod (1000*60)) div 1000"/> <xsl:value-of select="concat(format-number($minutes, '00'), ':', format-number($seconds, '00', 'european'))"/></xsl:template> The transformation looks nice, just the values do not fit all the time. If I have 1min29sec it is allright. If I have 1min44sec I get 2min out here. So it seems to round up from 0,5. How can I make that work correctly?Hope to hear from you soon\Loriot
  15. Thanks a lot! That worked.
  16. Hi all,I need some help with that. I am trying to get the date & time as a default value into a form.I tried a lot of variations with and without header functions like for example <input type="text" name="Time" value="?[$document.write(Date())]" /> How do I get this?? Thanx for any help you can give.\Loriot
  17. Hi again,I just wanted to post, that I finally found a solution to do the transformation in one step and I wanted to let you know. The XML is still teh one I posted a litlle further up. Here comes my stylesheet: <?xml version="1.0"?><xsl:stylesheet version= "1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:variable name="time_1" select="translate(substring(MainRoot/Time_1,12,8),'- :.','')" /><MainRoot><ShowStart><xsl:value-of select="MainRoot/Time_1"/></ShowStart><xsl:for-each select="MainRoot/Track//Element"><xsl:variable name="time_2" select="translate(substring(Time_2,11,9),'::','')" /> <xsl:if test="number($time_1) <= number($time_2)"> <Element> <xsl:value-of select="tag1" /> <xsl:value-of select="tag2"/> </Element> </xsl:if></xsl:for-each></MainRoot></xsl:template></xsl:stylesheet> So now I get only results from the elements with a time_2 being after the time_1 Have fun with that!!
  18. I had tried that already but it didn't work :-( The problem is, that I don't have the times on the same level. So my workaround is all about copyieng the root value into the element values and have in the second step an if test on values on (now) same level. So this is the challenge I don't get into one stylesheet
  19. That was a nice thing to get the first stylesheet a little smoother. Thanx for that!!But how do I get the xsl:if comparison into the same stylesheet. Have you also some idea about that?
  20. Hi again,I found a working solution now, but I have to do a double processing, so maybe you know something more elegant. If so: Please let me know!But: My solution works and here it comes.The original XML: <MainRoot> <Time_1>yyyy-mm-dd hh:mm:ss.msec</Time_1> <Track> <Element> <Time_2>yyyy-mm-dd hh:mm:ss.msec<Time_2> <Title>Title</Title> </Element> <Element> <Time_2>yyyy-mm-dd hh:mm:ss.msec<Time_2> <Title>other Title</Title> </Element> </Track></MainRoot> The first Stylesheet looks like that: <?xml version="1.0"?><xsl:stylesheet version= "1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:variable name="Time_1"> <xsl:value-of select="substring(Time_1,1,4)" /> <xsl:value-of select="substring(Time_1,6,2)" /> <xsl:value-of select="substring(Time_1,9,2)" /> <xsl:value-of select="substring(Time_1,12,2)" /> <xsl:value-of select="substring(Time_1,15,2)" /> <xsl:value-of select="substring(Time_1,18,2)" /> </xsl:variable> <MainRoot> <xsl:for-each select="/Track/Element[Class='Music']"> <Element> <Time_1><xsl:copy-of select="$Time_1" /></Time_1> <Time_2><xsl:value-of select="substring(Time_2,1,4)" /> <xsl:value-of select="substring(Time_2,6,2)" /> <xsl:value-of select="substring(Time_2,9,2)" /> <xsl:value-of select="substring(Time_2,12,2)" /> <xsl:value-of select="substring(Time_2,15,2)" /> <xsl:value-of select="substring(Time_2,18,2)" /><Time_2> <Title><xsl:value-of select="Title"/></Title> </Element> <MainRoot> </xsl:for-each></xsl:template></xsl:stylesheet> This delivers an XML file with comparable numbers as Times looking like yyyymmddhhmmssmsecThe result XML file is then processed with another stylesheet doing that: <xsl:if test="number(Time_1) <= number(Time_2)"></xsl:if> Is there a way to do this in one step?RegardsLoriot
  21. It seems to turn out working with a not yet completed combination of that <xsl:if test="number(substring(Time_1,12,2)) >= number(substring(Time_2,12,2)"> I get back with the complete solution after I combined it corectly.Thanx for the moment for being inspiering!
  22. No, that won't help. Other idea: My < comparing could probably work on numbers if I just get transformed the time.so if I take the substring hh.mm.ss.msec and transform it all to msec, then I can compare the numbers with <I am just not good eneough in this xsl:call-template xsl:with-param thing to get an idea how this calculation could be done. Have you?
  23. I wonder if can possible workaround that with some alphabetical order, because i can sort the dates in correct order. So is there possibly a function to compare strings making a<b?
  24. Hi all,I am trying to compare some dates but did not find the correct syntax until now.In the XML I find time tags like that <Time_1>YYYY-MM-DD hh:mm:ss.msec</Time_1> <Time_2>YYYY-MM-DD hh:mm:ss.msec</Time_2> Now I try to pick elements that have Time_1 < Time_2. I tried the following, but they don't work. <xsl:if test="dateTime(Time_1) < dateTime(Time_2)"><xsl:if test="Time_1 < Time_2"><xsl:if test="number(Time_1) < number(Time_2)"> Could you give me a hint?Thanx in advanceLoriot
×
×
  • Create New...