Jump to content

lukazar

Members
  • Posts

    10
  • Joined

  • Last visited

lukazar's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. I got it to work. Here is my final solution to the code <xsl:template match="title" name="intro"> <xsl:param name = "start" select="1" /> <xsl:param name = "end" select="60" /> <xsl:param name = "ln" select="1" /> <xsl:variable name="num" select="string-length(//floordoc/bill/title/para)" /> <xsl:choose> <xsl:when test="$end > $num"> <line number='{$ln}'> <xsl:value-of select="substring(//floordoc/bill/title/para,$start)"/> </line> </xsl:when> <xsl:otherwise> <line number='{$ln}'> <xsl:value-of select="substring(//floordoc/bill/title/para,$start,60)"/> </line> <xsl:call-template name="intro"> <xsl:with-param name = "start" select='$start+60'/> <xsl:with-param name = "end" select='$end+60'/> <xsl:with-param name = "ln" select= '$ln+1'/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template>
  2. Well, both actually, printing and viewing on the web. We need the documents converted to PDF for a number of reasons. I looked into the tokenizer, and as you said, it is not widely supported.You're correct in the xml to xml tranformation using a new DTD for the new xml file validation. I'm slowly starting to build up code that should accomplish this (I hope). I created a thread here http://w3schools.invisionzone.com/index.php?showtopic=6281 in the hopes of getting help with some syntax or any logic flaws.It seems that to be able to do what I'm trying to do, I need break up the para much like you show in your example. Where in stead of making it ready for XHTML I'd have somthing like: <para><line number=1>text</line><line number=2>text</line></para> To accomplish this I belive I need a recursive call and the param to be updated at each call. Again, I the link above shows where I've gotten so far with this idea.Thanks again for your input, it's giving my brain a good ol' kick start.EDITGot it figured out. Thanks for the help!
  3. I've played with it a bit more and my xslt is starting to look like this... <xsl:param name = "start">1</xsl:param> <xsl:param name = "end">60</xsl:param> <xsl:param name = "ln">1</xsl:param> <xsl:template match="floordoc/bill/title" name="intro"> <xsl:variable name = "num" select="string-length(floordoc/bill/title/para/text())" /> <ttl> <line number='$ln'> <xsl:choose> <xsl:when test="$end > $num"> <xsl:value-of select="substring(floordoc/bill/title/para/text(),$start)"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="substring(floordoc/bill/title/para/text(),$start,60)"/> </xsl:otherwise> </xsl:choose> </line> <xsl:call-template name="intro"> <xsl:with-param name = "start" select='$start+60'/> <xsl:with-param name = "end" select='$end+60'/> <xsl:with-param name = "ln" select= '$ln+1'/> </xsl:call-template> </ttl> </xsl:template> Am I off in the right direction?
  4. HiI'm trying to calculate the length of a string. Take the length divide it by 60, which will give me how many substrings I'll need.so for example say I have this: <title> <para> This is a para in which things are being type for an example in which somthing is to be done.... </para></title> How would I use the fn:string-length()?I guess what I want to do would look kind of like this, however I don't think it'll work exatly the same in xslt.Heres kind of what it would look like in java int count = STRING.length();int num = count / 10;int start = 0;int end = 9;for(int i = 0; i < num; i++){ x[] = STRING.substring(start, end); start = end + 1; end = end + 10;} I think this is KIND of how it would look in xslt, minus the things I don't know :-/ <xsl variable name = string select = title/para/text() /><xsl variable name = start select = 0 /><xsl variable name = end select = 10 /><fn:string-length($string)> => store to some value called temp<!-- xslt code here --> => temp / 10 -> store to some value call num<choose> <!-- not sure if this will act like a for loop. I doubt it, so I'll probably need somthing else --> <when (some sort of seletion here not sure what)> <!-- this is where the while num != somthing --> <myXMLtag> <fn:substring($string,$start,$end/> <xsl: variable name = start select = $start + $end /> <xsl: variable name = end select = $end + 10 /> <xsl: variable name = somthing select = somthing + 1 /> </myXMLtag> </when></choose> I'm not sure if what I'm trying to do is even possible Any direction or insite would be much appricated.
  5. Hmmm...I was told this verbatim:"first off, you'll need to do a translation of the xml to get line numbering, no way around it. It's really not that difficult to do, just word wrap and count. ... Create a new DTD for printing, then take the XML, pull all the information out and put it into a new XML file, then run the translation to print on the new XML"Is what he saying possible or correct? I've been reading as much as I can find on this, and I haven't gotten anywhere because I haven't found anything!Perhaps I just haven't found a good resource yet. Does anyone know of a good tutorial to do XML to XML using a new DTD?I'm sorry if my questions don't make any sense, it seems the more I get into xml the more confused I get Thanks
  6. Ok thanks I'll play around with it a bit. I have another question which I hope is easier Is is possible to indent a para every odd line....so for example: This line is odd and is indentedThis line is even and not indented This line is odd and is indented... Thanks
  7. Hi,I'm trying to number the lines of multiple paragraphs.For example: xml<bill>...<para>FOR AN ACT relating to crimes and offenses; to amend sections 28-101,28-201 and 28-932, Revised Statutes Cumulative Supplement, 2004; tochange provision relating to assault by a confined person; to create theoffense of assault...(etc)</para> I would need xsl code that makes the output look like so... 1 FOR AN ACT relating to crimes and offenses; to amend sections 2 28-101, 28-201 and 28-932, Revised Statutes Cumulative3 Supplement, 2004; to change provision relating to assault by a4 confined person; to creat the offense of assault...(etc) Can anyone help me with this? I just getting my feet wet with xsl, anyhelp would be much appreciated. Thanks,Luke
  8. lukazar

    XSL:FO

    Wow, that was really easy. Thanks -- you're the man.
  9. lukazar

    XSL:FO

    I'm looking to do it the hard way I'll try out your code here in a bit thanks! I have another question for you.I have a tag that looks like so: <transcription lengo="100" session="1" sessiontype="regular" status="RoughDraft" transtype="floor">....</transcription> Is it possible to pull out the value of status and show that? Say I create a PDF of the above code, I would like it to say RoughDraft or Complete in the header depending on status...Thanks again
  10. lukazar

    XSL:FO

    Hello,I'm trying to figure out a way to look through an XML document, find keywords, and then either bold those words, or highlight them. I have very little knowldege with xsl, so I would need quite a bit of help. Does anyone have time time to help me out, or know of a good reference that would aid in trying to accopmlish said task?Thanks,Luke
×
×
  • Create New...