Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions libyang/yangloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,6 @@ yangFileParse (yang_file_list_t *listp, const char *template,
yfp = yangFileLoadContents(listp, template, name, filename,
sourcefile, dict, partial);

fclose(sourcefile);

#if 0
yfp->yf_main = yangFindMain(yfp);
if (yfp->yf_main == NULL) {
Expand Down
8 changes: 8 additions & 0 deletions libyang/yangparser.y
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,14 @@ explicit_named_template :
K_TEMPLATE template_name
{
ALL_KEYWORDS_ON();

/*
* making a template, it has to be a child of the
* 'root' node which is the stylesheet
* note that this means that template procs must come
* after modules
*/
slaxPopToRoot(slax_data);
slaxElementPush(slax_data, ELT_TEMPLATE,
ATT_NAME, $2->ss_token);
$$ = NULL;
Expand Down
14 changes: 14 additions & 0 deletions libyang/yangstmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,3 +487,17 @@ yangStmtInit (void)
TAILQ_INIT(&yangStmtList);
yangStmtInitBuiltin();
}

xmlNodePtr
slaxPopToRoot (slax_data_t *sdp)
{
xmlNodePtr node, node_save;

node = node_save = sdp->sd_ctxt->node;
while (node && node->parent && node->parent->parent)
node = node->parent;

sdp->sd_ctxt->node = node;

return node_save;
}
3 changes: 3 additions & 0 deletions libyang/yangstmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,6 @@ yangStmtGetValue (slax_data_t *sdp, xmlNodePtr nodep, yang_stmt_t *ysp);

void
yangStmtCheckArgument (slax_data_t *sdp, slax_string_t *sp);

xmlNodePtr
slaxPopToRoot (slax_data_t *sdp);