Skip to content

Add examples/ directory - #98

Open
ctrlcctrlv wants to merge 1 commit into
benibela:masterfrom
ctrlcctrlv:examples
Open

Add examples/ directory#98
ctrlcctrlv wants to merge 1 commit into
benibela:masterfrom
ctrlcctrlv:examples

Conversation

@ctrlcctrlv

Copy link
Copy Markdown
Contributor

Promised in main README. Hopefully the beginning of many examples that don't require network connectivity.

@Reino17

Reino17 commented Jan 28, 2023

Copy link
Copy Markdown

xquery version "3.1"; [...] parse-xml('<html>...</html>')

xquery version "3.1-xidel"; [...] parse-html('<html>...</html>') (parse-html())

xidel --html --xquery3="$(cat examples/1.xq)"

There's --extract-file or -e @ for that, and --output-node-indent for some prettification:

xidel -s --extract-file="examples/1.xq" --output-format=html --output-node-indent
xidel -s -e @"examples/1.xq" --output-format=html --output-node-indent
<!DOCTYPE html>
<table>
  <tbody>
    <tr class="C_123 hascol1" id="123">
      <td>123</td>
      <!--  -->
    </tr>
    <tr class="C_456 C_other hascol1 hascomment" id="456">
      <td>456</td>
      <!-- other -->
    </tr>
    <tr class="C_foo C_columns hascol1 hascomment" id="foo">
      <td>foo</td>
      <!-- columns -->
    </tr>
    <tr class="C_bar C_are hascol1 hascomment" id="bar">
      <td>bar</td>
      <!-- are -->
    </tr>
    <tr class="C_xyz C_ignored C_zomg hascol1 hascomment zomg" id="xyz">
      <td name="zomg">xyz</td>
      <!-- ignored -->
    </tr>
  </tbody>
</table>

However, I think the wiki is a much better place for examples. It's still on my long to-do-list. And let's then start off with some easy examples first, because let's face it, this particular example is really for the advanced Xidel-user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants