figured out magic grouping

This commit is contained in:
Kyle Maxwell 2008-12-20 23:07:40 -08:00
parent dec0550afb
commit 87bc58d27e
7 changed files with 328 additions and 53 deletions

View File

@ -102,7 +102,7 @@ dexPtr dex_compile(char* dex_str, char* incl) {
sprintbuf(buf, " xmlns:date=\"http://exslt.org/dates-and-times\"");
sprintbuf(buf, " xmlns:exsl=\"http://exslt.org/common\"");
sprintbuf(buf, " xmlns:saxon=\"http://icl.com/saxon\"");
sprintbuf(buf, " exclude-result-prefixes=\"str math set func dyn exsl saxon user date\"");
sprintbuf(buf, " extension-element-prefixes=\"str math set func dyn exsl saxon user date\"");
sprintbuf(buf, ">\n");
sprintbuf(buf, "<xsl:output method=\"xml\" indent=\"yes\"/>\n");
sprintbuf(buf, "<xsl:strip-space elements=\"*\"/>\n");
@ -173,10 +173,14 @@ void __dex_recurse_foreach(struct json_object * json, char* key, struct json_obj
switch(json_object_get_type(inner)) {
case json_type_string:
if(has_expr) {
printf("parsing: %s\n", expr);
sprintbuf(buf, "<dexter:groups><xsl:for-each select=\"%s\"><dexter:group>\n", myparse(expr));
printf("error: %s\n", last_dex_error);
__dex_recurse(inner, buf, astrcat3(context, ".", tag));
} else {
printf("parsing: %s\n", json_object_get_string(inner));
sprintbuf(buf, "<dexter:groups><xsl:for-each select=\"%s\"><dexter:group>\n", myparse(json_object_get_string(inner)));
printf("error: %s\n", last_dex_error);
struct json_object * dot = json_object_new_string(".");
__dex_recurse(dot, buf, astrcat3(context, ".", tag));
}
@ -184,7 +188,9 @@ void __dex_recurse_foreach(struct json_object * json, char* key, struct json_obj
break;
case json_type_object:
if(has_expr) {
printf("parsing: %s\n", expr);
sprintbuf(buf, "<dexter:groups><xsl:for-each select=\"%s\"><dexter:group>\n", myparse(expr));
printf("error: %s\n", last_dex_error);
__dex_recurse(inner, buf, astrcat3(context, ".", tag));
sprintbuf(buf, "</dexter:group></xsl:for-each></dexter:groups>\n");
} else {
@ -198,46 +204,8 @@ void __dex_recurse_foreach(struct json_object * json, char* key, struct json_obj
__dex_recurse(val, buf, astrcat3(context, ".", tag));
};
sprintbuf(buf, "</%s>\n", tag);
// char *tag;
// char *ptr;
// char *expr;
// int offset;
// bool has_expr;
// int is_arr;
// int is_simple_arr;
// offset = 0;
// tag = astrdup(key);
// expr = astrdup(key);
// ptr = tag;
// has_expr = false;
// while(*ptr++ != '\0'){
// offset++;
// if(*ptr == '(') {
// *ptr = 0;
// has_expr = true;
// break;
// }
// }
// expr += offset;
//
// if(!has_expr) expr = ".";
// if(is_arr = json_object_is_type(val, json_type_array) ) {
// struct json_object * inner = json_object_array_get_idx(val, 0);
// if(is_simple_arr = json_object_is_type(inner, json_type_string)) {
// expr = json_object_get_string(inner);
// }
// }
//
// sprintbuf(buf, "<%s>\n", tag);
// if(is_arr) sprintbuf(buf, "<dexter:groups><xsl:for-each select=\"%s\">\n", myparse(expr));
// __dex_recurse(val, buf, astrcat3(context, ".", tag));
// if(is_arr) sprintbuf(buf, "</xsl:for-each></dexter:groups>\n");
// sprintbuf(buf, "</%s>\n", tag);
}
void __dex_recurse_array(struct json_object * json, struct printbuf* buf, char *context) {
printf("WTF!!!!!!!\n");
}

View File

@ -29,18 +29,25 @@ int main (int argc, char **argv) {
struct printbuf *buf = printbuf_new();
FILE * fd = fopen(argv[1], "r");
printbuf_file_read(fd, buf);
dexPtr dex = dex_compile(buf->buf, "");
// printf("hi\n");
struct printbuf *incl = printbuf_new();
FILE * inclf = fopen("group-after.xml", "r");
printbuf_file_read(inclf, incl);
dexPtr dex = dex_compile(buf->buf, incl->buf);
printf("hi\n");
xmlDocPtr xml = dex_parse_file(dex, argv[2], 1);
// printf("%s\n", xml);
// printf("%s\n", dex->error);
printf("hi\n");
printf("%s\n", xml);
printf("%s\n", dex->error);
struct json_object *json = xml2json(xml->children->children);
printf("%s\n", json_object_to_json_string(json));
// struct json_object *json = xml2json(xml->children->children);
// printf("%s\n", json_object_to_json_string(json));
// xmlSaveFile("-", xml);
xmlSaveFile("-", xml);
return 0;
}

240
fixtures/craig.html Normal file
View File

@ -0,0 +1,240 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<title>SF bay area architect/engineer/CAD jobs classifieds - craigslist</title>
<meta name="description" content="craigslist architect/engineer/CAD jobs classifieds for SF bay area ">
<meta name="keywords" content="SF bay area architect/engineer/CAD jobs craigslist, classifieds, want ads ">
<link rel=alternate type="application/rss+xml" href="index.rss" title="RSS feed for craigslist | architect/engineer/CAD jobs in SF bay area ">
<link rel="stylesheet" title="craigslist" href="http://www.craigslist.org/styles/craigslist.css" type="text/css" media="all">
</head>
<body class="toc">
<div>
<a name="top"></a>
<p>hi!?</p>
<div class="bchead"><span id="ef">
[ <a href="http://www.craigslist.org/about/help/">help</a> ]
[ <a href="https://post.craigslist.org/sfo/J">post</a> ]</span>
<a href="/"> SF bay area craigslist</a> &gt; <a href="/egr/">architect/engineer/CAD jobs</a><div id="satabs"> <b>all SF bay area</b> <a href="/sfc/egr/">san francisco</a> <a href="/sby/egr/">south bay</a> <a href="/eby/egr/">east bay</a> <a href="/pen/egr/">peninsula</a> <a href="/nby/egr/">north bay</a> <a href="/scz/egr/">santa cruz</a> </div>
</div>
<blockquote>
<form action="/search/egr" method="get" onsubmit="ckCAbb();">
<script type="text/javascript"><!--
function ckCAbb() {
t = document.getElementById("cAbb");
if (t.value == "egr") { t.disabled = true; }
}
-->
</script>
<table width="95%" cellpadding="2" style="white-space: nowrap; background:#eee; border:1px solid gray;" summary="">
<tr>
<td align="right" width="1">search for:</td>
<td width="30%"><input id="query" name="query" size="30" value=""> in:
<select id="cAbb" name="catAbbreviation">
<option value="ccc">all community<option value="eee">all event<option value="sss">all for sale / wanted<option value="ggg">all gigs<option value="hhh">all housing<option value="jjj">all jobs<option disabled value="">--<option value="ofc"> admin/office jobs
<option value="bus"> business jobs
<option value="csr"> customer service jobs
<option value="edu"> education jobs
<option value="egr" selected> engineering jobs
<option value="etc"> etcetera jobs
<option value="acc"> finance jobs
<option value="fbh"> food/bev/hosp jobs
<option value="lab"> general labor jobs
<option value="gov"> government jobs
<option value="hea"> healthcare jobs
<option value="hum"> human resource jobs
<option value="eng"> internet engineering jobs
<option value="lgl"> legal jobs
<option value="mnu"> manufacturing jobs
<option value="mar"> marketing jobs
<option value="med"> media jobs
<option value="npo"> nonprofit jobs
<option value="rej"> real estate jobs
<option value="rfh"> retail/food/hospitality jobs
<option value="ret"> retail/wholesale jobs
<option value="sls"> sales jobs
<option value="spa"> salon/spa/fitness
<option value="sci"> science jobs
<option value="sec"> security jobs
<option value="trd"> skilled trades jobs
<option value="sof"> software jobs
<option value="sad"> systems/networking jobs
<option value="tch"> tech support jobs
<option value="trp"> transport jobs
<option value="tfr"> tv video radio jobs
<option value="web"> web design jobs
<option value="wri"> writing jobs
<option disabled value="">--<option value="ppp">all personals<option value="res">all resume<option value="bbb">all services offered</select>
<input type="submit" value="Search">
</td><td>
<label><input type="checkbox" name="srchType" value="T"
title="check this box to search only posting titles"> only search titles</label>
</td>
</tr>
<tr>
<td align="right" width="1"></td>
<td>
<input type="checkbox" name="addOne" id="tc" value="telecommuting"><label for="tc">telecommute</label>
<input type="checkbox" name="addTwo" id="ct" value="contract"><label for="ct">contract</label>
<input type="checkbox" name="addThree" id="it" value="internship"><label for="it">internship</label>
<input type="checkbox" name="addFour" id="pt" value="part-time"><label for="pt">part-time</label>
<input type="checkbox" name="addFive" id="np" value="non-profit"><label for="np">non-profit</label>
</td>
<td align="left"><label><input type="checkbox" name="hasPic" value="1"> has image</label></td>
</tr></table></form></blockquote><span id="showPics"></span><span id="hidePics"></span>
<blockquote>
<table width="95%" summary="">
<tr>
<td valign="top">[ Sat, 20 Dec 16:32:46 ]</td>
<td valign="top" id="messages"><span class="hl"> [ <a href="/about/craigslist_is_hiring"><font color="green">craigslist is hiring!</font></a> ] </span> <span class="hl"> [ <a href="/forums/?forumID=7">jobs forum</a> ]</span> <span class="hl"> [ <a href="http://www.craigslist.org/about/job_boards_compared">craigslist vs monster vs careerbuilder</a> ] </span> <span class="hl"> [ <b><a href="/about/safety">PERSONAL SAFETY TIPS</a></b> ] </span> <span class="hl"> [ <b><a href="/about/scams">AVOIDING SCAMS &amp; FRAUD</a></b> ] </span> <span class="hl"> [<a href="/cgi-bin/success.stories.cgi">success story?</a>]</span> </td>
</tr>
</table>
<b><h4>Fri Dec 19</h4></b>
<p><a href="/eby/egr/964421077.html">Facilities Construction Manager -</a><font size="-1"> (oakland downtown)</font></p>
<p><a href="/sby/egr/964347692.html">Mechanical Design Engineer -</a><font size="-1"> (los gatos)</font></p>
<p><a href="/sby/egr/964344826.html">Wanted: Inventor and Teacher at the Tech Museum this summer! -</a><font size="-1"> (san jose downtown)</font> <span class="p"> img</span></p>
<p><a href="/pen/egr/964315919.html">Project/Senior Engineering Geologists -</a><font size="-1"> (palo alto)</font></p>
<p><a href="/eby/egr/964186889.html">Mechanical Contractor - Project Engineer -</a><font size="-1"> (richmond / point / annex)</font></p>
<p><a href="/sby/egr/964063522.html">ASIC Verification Engineer ñ Digital SOC Flow -</a><font size="-1"> (sunnyvale)</font></p>
<p><a href="/sby/egr/964060193.html">ASIC Verification Engineer - SOC -</a><font size="-1"> (sunnyvale)</font></p>
<p><a href="/sby/egr/964049904.html">ASIC Verificaiton Engineer - Digital IP -</a><font size="-1"> (sunnyvale)</font></p>
<b><h4>Thu Dec 18</h4></b>
<p><a href="/pen/egr/963290168.html">Photovoltaic Cell Development Engineer -</a><font size="-1"> (mountain view)</font></p>
<p><a href="/pen/egr/963286774.html">EE, Systems Engineer -</a><font size="-1"> (mountain view)</font></p>
<p><a href="/pen/egr/963282649.html">Director of Field Operations -</a><font size="-1"> (mountain view)</font></p>
<p><a href="/pen/egr/963279113.html">Director of PV Systems Engineering -</a><font size="-1"> (mountain view)</font></p>
<p><a href="/pen/egr/963266215.html">Mechanical Designer/CAD Specialist -</a><font size="-1"> (mountain view)</font></p>
<p><a href="/pen/egr/963257870.html">Senior FEA Mechanical Engineer -</a><font size="-1"> (mountain view)</font></p>
<p><a href="/pen/egr/963158043.html">Estimator (Plumbing) -</a><font size="-1"> (brisbane)</font></p>
<p><a href="/pen/egr/963079292.html">User Testing - Small business owner/manager -</a><font size="-1"> (redwood city)</font></p>
<p><a href="/eby/egr/962920145.html">Hardware Engineer -</a><font size="-1"> (fremont / union city / newark)</font></p>
<b><h4>Wed Dec 17</h4></b>
<p><a href="/eby/egr/962065415.html">Job Captain/Sr Cad drafter -</a><font size="-1"> (dublin / pleasanton / livermore)</font></p>
<p><a href="/sby/egr/962038943.html">Application Engineer/Flash Product -</a><font size="-1"> (san jose north)</font></p>
<p><a href="/pen/egr/962032212.html">Development Engineer -</a><font size="-1"> (redwood city)</font></p>
<p><a href="/sby/egr/962026568.html">Application Engineer/Memory Module -</a><font size="-1"> (san jose north)</font></p>
<p><a href="/pen/egr/961992859.html">Senior Mechanical Engineer - VERY cool opportunity -</a><font size="-1"> (belmont)</font></p>
<p><a href="/eby/egr/961927431.html">Pipeline &amp; Refinery Engineering -</a><font size="-1"> (walnut creek)</font></p>
<p><a href="/sby/egr/961834211.html">Senior Project Engineer (Electrical) with Solar Design Firm -</a></p>
<p><a href="/sfc/egr/961673308.html">Architects for ROMA Design Group -</a><font size="-1"> (north beach / telegraph hill)</font></p>
<b><h4>Tue Dec 16</h4></b>
<p><a href="/eby/egr/960855294.html">INTERMEDIATE &amp; PROJECT ARCHITECT NEEDED -</a><font size="-1"> (East bay)</font></p>
<p><a href="/eby/egr/960696556.html">Intermediate Architect -</a><font size="-1"> (walnut creek)</font></p>
<p><a href="/sby/egr/960563600.html">EMS Software Engineer -</a><font size="-1"> (mountain view)</font></p>
<p><a href="/eby/egr/960563347.html">Senior Project Manager-Water/Wastewater -</a><font size="-1"> (walnut creek)</font></p>
<p><a href="/eby/egr/960557904.html">Senior Engineering Manager-Water/Wastewater -</a><font size="-1"> (walnut creek)</font></p>
<p><a href="/sby/egr/960446342.html">Biologist / Env Scientist (Const Compliance) - HDR, INC. -</a><font size="-1"> (Sunnyvale, CA)</font></p>
<p><a href="/nby/egr/960444728.html">Architect / Project Manager -</a><font size="-1"> (san rafael)</font></p>
<p><a href="/sby/egr/960363198.html">HYBRID MIC PROCESS ENGINEER -</a><font size="-1"> (san jose north)</font></p>
<p><a href="/pen/egr/960299841.html">Part-Time Interior Design AutoCAD Instructor, $56.37 - $76.26 Per Hour -</a><font size="-1"> (redwood city)</font></p>
<p><a href="/sby/egr/960246769.html">Manufacturing Engineer (Jr.) -</a><font size="-1"> (sunnyvale)</font></p>
<p><a href="/sby/egr/960232140.html">Senior Mechanical Technician: Solar start-up company -</a><font size="-1"> (sunnyvale)</font></p>
<p><a href="/pen/egr/960167432.html">Project &amp; Senior Geotechnical Engineers -</a><font size="-1"> (palo alto)</font></p>
<p><a href="/scz/egr/960081073.html">Sr. Design Engineer -</a><font size="-1"> (Santa Cruz)</font></p>
<p><a href="/sfc/egr/960073198.html">PATENT ANALYST -</a><font size="-1"> (Alexandria)</font></p>
<p><a href="/eby/egr/959994150.html">Electrical Consulting Engineer P.E. -</a><font size="-1"> (concord / pleasant hill / martinez)</font></p>
<p><a href="/eby/egr/959909510.html">senior project manager -</a><font size="-1"> (hayward / castro valley)</font></p>
<b><h4>Mon Dec 15</h4></b>
<p><a href="/eby/egr/959631406.html">Product Support Engineers ñ Fremont, CA -</a><font size="-1"> (fremont / union city / newark)</font> <span class="p"> img</span></p>
<p><a href="/eby/egr/959502706.html">MEP Seismic Bracing CAD Detailer -</a><font size="-1"> (fremont / union city / newark)</font></p>
<p><a href="/sby/egr/959490625.html">Data Center Operations Systems Administrator -</a><font size="-1"> (cupertino)</font></p>
<p><a href="/eby/egr/959487059.html">MEP Seismic Bracing Detailer -</a><font size="-1"> (fremont / union city / newark)</font></p>
<p><a href="/eby/egr/959482650.html">Seismic Bracing Technical Support Engineer -</a><font size="-1"> (fremont / union city / newark)</font></p>
<p><a href="/sfc/egr/959473567.html">DESIGN ASSISTANT: High-end Residential ID Firm -</a><font size="-1"> (north beach / telegraph hill)</font></p>
<p><a href="/sfc/egr/959430923.html">Utilities Engineer -</a></p>
<p><a href="/sby/egr/958983286.html">VP of Engineering -</a><font size="-1"> (sunnyvale)</font></p>
<p><a href="/sfc/egr/958779795.html">Utilities Engineer -</a><font size="-1"> (downtown / civic / van ness)</font></p>
<p><a href="/sby/egr/958657443.html">TCAD Applications Engineer -</a><font size="-1"> (santa clara)</font> <span class="p"> img</span></p>
<p><a href="/sfc/egr/958513869.html">Design Engineer I -</a><font size="-1"> (Fremont)</font></p>
<b><h4>Sun Dec 14</h4></b>
<p><a href="/eby/egr/957947246.html">Civil/Structural Engineer -</a><font size="-1"> (walnut creek)</font></p>
<p><a href="/eby/egr/957926343.html">Structural Engineer -</a><font size="-1"> (oakland downtown)</font></p>
<b><h4>Sat Dec 13</h4></b>
<p><a href="/sby/egr/956799683.html">RF PCB Layout using Altium Designer 6 -</a><font size="-1"> (saratoga)</font></p>
<b><h4>Fri Dec 12</h4></b>
<p><a href="/eby/egr/955803536.html">System Engineer -</a><font size="-1"> (Walnut Creek)</font></p>
<p><a href="/sby/egr/955552810.html">R F Engineer -</a><font size="-1"> (mountain view)</font></p>
<p><a href="/sby/egr/955540856.html">Sr. Biomedical Mechanical Engineer/Project Lead ñMedical devices -</a><font size="-1"> (Silicon Valley)</font></p>
<p><a href="/sby/egr/955497027.html">SR RFIC Engineer &amp; ASIC Designer &amp; FAE positions -</a><font size="-1"> (Silicon Valley)</font></p>
<p><a href="/eby/egr/955402371.html">Design Engineer -</a><font size="-1"> (oakland downtown)</font></p>
<p><a href="/sfc/egr/955154593.html">Building Efficiency Group Lead for Sustainable Energy Research Center -</a><font size="-1"> (Cambridge, Massachusetts)</font></p>
<b><h4>Thu Dec 11</h4></b>
<p><a href="/nby/egr/954605064.html">Architect -</a><font size="-1"> (sonoma)</font></p>
<p><a href="/eby/egr/954518013.html">Senior Streaming Software Engineer -</a><font size="-1"> (alameda)</font></p>
<p><a href="/eby/egr/954511196.html">Senior Firmware Engineer -</a><font size="-1"> (alameda)</font></p>
<p><a href="/sfc/egr/954450513.html">PROJECT ENGINEER/ASST. PROJECT MANAGER - CONSTRUCTION -</a><font size="-1"> (SF)</font></p>
<p><a href="/eby/egr/954421315.html">Biofuel Startup - Process Engineer -</a><font size="-1"> (Remote &amp; UCSF)</font></p>
<p><a href="/sby/egr/954420560.html">Architectural Job Captain: K-12 Schools, DSA, Higher-ed OR Healthcare -</a><font size="-1"> (san jose downtown)</font></p>
<p><a href="/sfc/egr/954364135.html">Senior Project Manager - Healthcare Architecture -</a><font size="-1"> (94157)</font></p>
<p><a href="/sfc/egr/954363683.html">Project Architect - Healthcare -</a><font size="-1"> (94157)</font></p>
<p><a href="/sfc/egr/954354029.html">Sr. Medical Planner -</a><font size="-1"> (94157)</font></p>
<p><a href="/sfc/egr/954345039.html">Senior Technical Architect - Healthcare -</a><font size="-1"> (94101)</font></p>
<p><a href="/sfc/egr/954336912.html">HealthCare - Administration -</a><font size="-1"> (94102)</font></p>
<p><a href="/sby/egr/954324727.html">Senior Manufacturing Engineer - Concentric Medical -</a><font size="-1"> (mountain view)</font></p>
<p><a href="/sfc/egr/954279878.html">salesforce.com: Senior Unix Storage Engineer -</a><font size="-1"> (financial district)</font></p>
<p><a href="/sfc/egr/954248985.html">salesforce.com: Manager, Performance &amp; Scalability Quality Engineering -</a><font size="-1"> (financial district)</font></p>
<p><a href="/eby/egr/954169703.html">Audio Visual AutoCAD drafter / engineer needed -</a><font size="-1"> (Hercules)</font></p>
<p><a href="/eby/egr/953979315.html">Shop Drawing Draftsman for Commercial Construction -</a><font size="-1"> (fremont / union city / newark)</font></p>
<p><a href="/sby/egr/953940537.html">Senior Mechanical Engineer -</a><font size="-1"> (mountain view)</font></p>
<p><a href="/sfc/egr/953568051.html">PCB Layout Engineer -</a><font size="-1"> (Milpitas, California)</font></p>
<b><h4>Wed Dec 10</h4></b>
<p><a href="/nby/egr/953142890.html">Inside Sales- ARCHITECTURAL HOUSE PLANS -</a><font size="-1"> (novato)</font></p>
<p><a href="/sby/egr/953050855.html">Sr. Estimator - Construction -</a><font size="-1"> (san jose north)</font></p>
<p><a href="/eby/egr/952896144.html">System Engineer -</a></p>
<p><a href="/nby/egr/952867527.html">Utility Analysis/Auditing -</a><font size="-1"> (novato)</font></p>
<p><a href="/nby/egr/952730003.html">Mechanical/Manufacturing Engineer -</a><font size="-1"> (santa rosa)</font></p>
<p><a href="/sby/egr/952676350.html">Mechanical Design Engineer -</a><font size="-1"> (san jose north)</font></p>
<b><h4>Tue Dec 09</h4></b>
<p><a href="/pen/egr/952163965.html">ARCHITECT FREELANCE -</a><font size="-1"> (redwood city)</font></p>
<p><a href="/eby/egr/951831962.html">Test/Failure Analysis Technician -</a><font size="-1"> (berkeley)</font></p>
<p><a href="/sby/egr/951804510.html">Engineering Technician -</a><font size="-1"> (mountain view)</font></p>
<p><a href="/eby/egr/951772256.html">CONSTRUCTION ESTIMATOR -</a><font size="-1"> (concord / pleasant hill / martinez)</font></p>
<p><a href="/pen/egr/951742592.html">ArchiCAD Drafter: Residential Architecture, ArchiCAD required -</a><font size="-1"> (woodside)</font></p>
<p><a href="/eby/egr/951625955.html">AutoCAD Operator -</a><font size="-1"> (dublin / pleasanton / livermore)</font></p>
<p><a href="/sby/egr/951492893.html">ADVANCED MFG TECHNICAL ENGINEER -</a><font size="-1"> (san jose north)</font></p>
<p><a href="/sby/egr/951353740.html">Data Center Operations Systems Administrator -</a><font size="-1"> (cupertino)</font></p>
<p><a href="/pen/egr/951247333.html">Managing Engineer, Technology Development (1006) -</a><font size="-1"> (menlo park)</font></p>
<p><a href="/pen/egr/951236800.html">Technician, Technology Development (2381) -</a><font size="-1"> (menlo park)</font></p>
<b><h4>Mon Dec 08</h4></b>
<h4>fake!!!</h4>
<p><a href="/eby/egr/950510164.html">Solar Power Project Support Engineer -</a></p>
<p><a href="/sby/egr/950387318.html">Server Database Engineer at TiVo -</a><font size="-1"> (santa clara)</font></p>
<p><a href="/sfc/egr/950311298.html">GIS Technician (Part-Time) -</a><font size="-1"> (downtown / civic / van ness)</font></p>
<p><a href="/sfc/egr/950200245.html">Construction Scheduler/Cost Specialist -</a><font size="-1"> (San Francisco)</font></p>
<p><a href="/sfc/egr/950168319.html">printed-circuit board layout and autocad -</a><font size="-1"> (SOMA / south beach)</font></p>
<p align="center"><font size="4"><a href="index100.html">next 100 postings</a></font>
<div id="footer">
<hr>
<span id="copy">
Copyright &copy; 2008 craigslist, inc.<br>
<a href="#top">Back to top of page</a>
</span>
<span class="rss">
<a class="l" href="http://sfbay.craigslist.org/egr/index.rss">RSS</a>
<a href="http://www.craigslist.org/about/rss">(?)</a><br>
<a class="y" href="http://add.my.yahoo.com/rss?url=http://sfbay.craigslist.org/egr/index.rss">add to My Yahoo!</a>
</span>
</div>
<br><br>
<div id="floater">&nbsp;</div>
</blockquote>
</div>
</body>
</html>

4
fixtures/dumb_craig.dex Normal file
View File

@ -0,0 +1,4 @@
{
"titles": ["h4"],
"entries": ["p"]
}

33
fixtures/smart.xslt Normal file
View File

@ -0,0 +1,33 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dexter="http://kylemaxwell.com/dexter" xmlns:str="http://exslt.org/strings" xmlns:set="http://exslt.org/sets" xmlns:math="http://exslt.org/math" xmlns:func="http://exslt.org/functions" xmlns:user="http://kylemaxwell.com/dexter/user-functions" xmlns:dyn="http://exslt.org/dynamic" xmlns:date="http://exslt.org/dates-and-times" xmlns:exsl="http://exslt.org/common" xmlns:saxon="http://icl.com/saxon" version="1.0" extension-element-prefixes="str math set func dyn exsl saxon user date">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<dexter:root>
<day>
<dexter:groups>
<xsl:for-each select=".//b/h4">
<dexter:group>
<title><xsl:value-of select="key('hafter', last() - position())"/></title>
<entries>
<dexter:groups>
<xsl:for-each select="key('pafter', last() - position())">
<xsl:if test="position() &lt; 5">
<dexter:group><xsl:value-of select="."/></dexter:group>
</xsl:if>
</xsl:for-each>
</dexter:groups>
</entries>
</dexter:group>
</xsl:for-each>
</dexter:groups>
</day>
</dexter:root>
</xsl:template>
<xsl:key name="hafter" match="//b/h4" use="count(following::b/h4)" />
<xsl:key name="pafter" match="//p/a" use="count(following::b/h4)" />
</xsl:stylesheet>

6
fixtures/smart_craig.dex Normal file
View File

@ -0,0 +1,6 @@
{
"day(user:group-after(h4))": [{
"title": "h4",
"entries": ["p"]
}]
}

View File

@ -211,8 +211,9 @@ AbbreviatedAxisSpecifier
| { $$ = ""; }
;
Expr
: OrExpr %dprec 1
| selectors_group %dprec 2
: LPAREN Expr RPAREN %dprec 1
| OrExpr %dprec 2
| selectors_group %dprec 3
;
PrimaryExpr
: VariableReference
@ -238,7 +239,6 @@ ArgumentSet
Argument
: Expr
;
UnionExpr
: PathExpr
| UnionExpr PIPE PathExpr { $$ = astrcat3($1, $2, $3); }
@ -375,11 +375,28 @@ ExprWhitespace
: S
FunctionName
: NAME
: QName
;
QName
: NAME
: PrefixedName
| UnprefixedName
;
PrefixedName
: Prefix COLON LocalPart { $$ = astrcat3($1, $2, $3); }
;
UnprefixedName
: LocalPart
;
Prefix
: NCName
;
LocalPart
: NCName
;
NCName
@ -533,6 +550,7 @@ OptS
%%
char* myparse(char* string){
// start_debugging();
prepare_parse(string);
yyparse();
cleanup_parse();
@ -543,7 +561,6 @@ void answer(char* a){
parsed_answer = a;
}
void start_debugging(){
yydebug = 1;
return;