hdoc_to_neo4j.xsl 2.06 KB
Newer Older
Esquilax76's avatar
Esquilax76 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xpath-default-namespace="http://www.utc.fr/ics/hdoc/xhtml"
    exclude-result-prefixes="xs"
    version="2.0">
    
    <xsl:output method="text" indent="no"/>
   
    <xsl:template match="/">
        <xsl:apply-templates/>
    </xsl:template>
    
    <xsl:template match="head"/>
    
Tyrannas's avatar
Tyrannas committed
16 17
    <xsl:template match="body">
        MERGE (i:module {title:"<xsl:value-of select="concat(../head/title,' (',string-length(.), ')')"/>"});
Esquilax76's avatar
Esquilax76 committed
18
        <xsl:apply-templates select="./section"/>
Esquilax76's avatar
Esquilax76 committed
19 20 21
    </xsl:template>
    
    <xsl:template match="body/section">
Tyrannas's avatar
Tyrannas committed
22 23
        MERGE (i:item {title:"<xsl:value-of select="concat(./header/h1,' (',string-length(.), ')')"/>"});
        MATCH (l1:item {title:"<xsl:value-of select="concat(./header/h1,' (',string-length(.), ')')"/>"}), (l2:module {title:"<xsl:value-of select="concat(ancestor::html/head/title,' (',string-length(ancestor::html/body), ')')"/>"}) MERGE (l2)-[:LIEN]->(l1);
Esquilax76's avatar
Esquilax76 committed
24 25 26 27
        <xsl:apply-templates select="./section"/>
    </xsl:template>
    
    <xsl:template match="body/section/section">
Tyrannas's avatar
Tyrannas committed
28 29 30
        MERGE (i:item {title:"<xsl:value-of select="concat(./header/h1,' (',string-length(.), ')')"/>"});
        MATCH (l1:item {title:"<xsl:value-of select="concat(./header/h1,' (',string-length(.), ')')"/>"}), (l2:item {title:"<xsl:value-of select="concat(parent::section/header/h1,' (',string-length(parent::section), ')')"/>"}) MERGE (l2)-[:LIEN]->(l1);
        <!--<xsl:apply-templates select="./div"/>-->
Esquilax76's avatar
Esquilax76 committed
31
    </xsl:template>
Tyrannas's avatar
Tyrannas committed
32 33 34 35 36 37 38 39 40 41 42 43 44
    
    <!--
      <xsl:template match="body/section[@data-hdoc-type]">
        MERGE (i:<xsl:value-of select="./@data-hdoc-type"/> {title:"<xsl:value-of select="./header/h1"/>"});
        <xsl:apply-templates select="./section"/>
    </xsl:template>
    
    <xsl:template match="body/section[not(@data-hdoc-type)]">
        MERGE (i:item {title:"<xsl:value-of select="./header/h1"/>"});
        <xsl:apply-templates select="./section"/>
    </xsl:template>
    -->
     
Esquilax76's avatar
Esquilax76 committed
45
</xsl:stylesheet>