xn/doc/03_bangs.md
2026-04-26 18:08:49 +00:00

54 lines
877 B
Markdown

# Bang Reference
## `!add(name:string)`
Appends a new node into the context.
Example:
```xn
# Add 1 to all LcId
$("//RxPdo/Index[.="#x1600"]/..")
{
# Add a new Entry with attribute "added" set to "true"
!add("Entry")
{
attr("added", "true");
}
};
```
## `!before(name:string)`
Appends a new node before the context.
Example:
```xn
# Add 1 to all LcId
$("//RxPdo/Index[.="#x1600"]/..")
{
# Add a new TxPdo with attribute "added" set to "true" before the above node selection
!before("TxPdo")
{
attr("added", "true");
}
};
```
## `!after(name:string)`
Appends a new node after the context.
Example:
```xn
# Add 1 to all LcId
$("//RxPdo/Index[.="#x1600"]/..")
{
# Add a new TxPdo with attribute "added" set to "true" after the above node selection
!after("TxPdo")
{
attr("added", "true");
}
};
```