I know that this work is something unorthodox, but I hope someone can help me XML files on the products Based on this, I am trying to create a valid latex file using XQuery. The XML file (xml / products.xml) looks like this:
& lt ;? XML version = "1.0"? & Gt; & Lt; Products & gt; & Lt; Creator's name = "A" & gt; & Lt; PC model = "1001" value = "2114" & gt; & Lt; Speed & gt; 2.66 & lt; / Speed & gt; & Lt; RAM & gt; 1024 & lt; / RAM & gt; & Lt; HardDisk & gt; 250 & lt; / Harddisk & gt; & Lt; / PC & gt; This is the required latex output:
\ documentclass [] {article} \ start {document} \ start {cent} \ start {tabular} {| L L |} \ hline Price & amp; Model \\ \ hline Price Price & amp; Model Value \\ \ hline \ end {tabular} \ end {center} \ end {document} And I have created XQuery to create the necessary latex: Let's get $ oc: = "& amp; # 123;" (: For {:) let $ cc: = "& amp; # 125;" (For:) :) $ space: = "& amp; # 32;" (Space: let's go to $ tab: = "& amp; # 9;" (Tab: Come on $ Ampersand: = "& amp; # 38;" (: Ampersand) \\ documentclass \ [\] {$ oc} article {$ cc} \\ $ {document} {$ cc} \\ start {$ oc} center {$ cc} \\ commence {$ OC} } Tabulated {$ CC} {$ OC} | L L $ {cc} \\ hline model {$ ampersand} value {$ space} \\\\ {$ space} \\ $ {$ dc ("xml / products.xml") for $ pc / product / manufacturer $ / Value: $ data = $ ($ PC / @ price) $ Model: = Data ($ PC / @ model) back {$ Model} {$ ampersand} {$ price} \\\\ \\ hline} \ \ End {$ oc} table {$ cc} \\ end {$ oc} center {$ cc} \\ end {$ oc} document {$ cc} I can not find Query to work .. :( .And as always, XQuery does not give much debug info. What to avoid using XQuery Are there better ways to do it? Or maybe you're printing text directly?
This is a possible solution: / P>
namespace output = "declare http://www.w3.org" / 2010 / xslt-xquery-serialization "; declare option output: method" text "; concat (" \ documentclass " [] {Article} \ documentclass [] {article} \ start {document} \ begin {cent} \ start {tabular} {| | l |} \ hline price & model \\ \ hline>, $ Give $ value to doctor ("xml / products.xml") / product / manufacturer / pc in PC: = data ($ PC / @ price) $ Model: = Data ($ PC / @ Models) Return Concat ($ Model, "& amp; Amp; ", $ Value," \\ \ hline ")," \ end {tabular} \ end {center} \ end {document} ") Note that you can further modify The data may need to be returned from the products.xml so that it can be configured with latex syntax.
Comments
Post a Comment