Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hdoc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Stephane Crozat
hdoc
Commits
acb5e7e4
Commit
acb5e7e4
authored
Dec 13, 2015
by
Bastien FREMONDIERE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug
parent
6dacfa3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
41 deletions
+49
-41
mindmapping_to_hdoc/xslt/sect.xsl
mindmapping_to_hdoc/xslt/sect.xsl
+49
-41
No files found.
mindmapping_to_hdoc/xslt/sect.xsl
View file @
acb5e7e4
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version=
"2.0"
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
xpath-default-namespace=
"http://www.utc.fr/ics/hdoc/xhtml"
xmlns=
"http://www.utc.fr/ics/hdoc/xhtml"
xmlns:utc=
"http://www.utc.fr/ics/hdoc/xhtml"
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
>
<xsl:stylesheet
version=
"2.0"
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
xmlns=
"http://www.utc.fr/ics/hdoc/xhtml"
xmlns:utc=
"http://www.utc.fr/ics/hdoc/xhtml"
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
>
<!-- This is wrong -> xpath-default-namespace="http://www.utc.fr/ics/hdoc/xhtml"-->
<xsl:output
method=
"xml"
indent=
"yes"
/>
<xsl:strip-space
elements=
"*"
/>
<xsl:template
match=
"map"
>
<xsl:processing-instruction
name=
"oxygen"
>
RNGSchema="http://scenari.utc.fr/hdoc/schemas/xhtml/hdoc1-xhtml.rng" type="xml"
</xsl:processing-instruction>
<html>
<head>
<xsl:apply-templates
mode=
"header"
></xsl:apply-templates
>
<xsl:apply-templates
mode=
"header"
/
>
</head>
<body>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template
match=
"node[1]"
mode=
"header"
>
<title><xsl:value-of
select=
"@TEXT"
/></title>
<meta
charset=
"utf-8"
/>
<meta
name=
"author"
content=
""
/>
<title>
<xsl:value-of
select=
"@TEXT"
/><xsl:value-of
select=
"richcontent"
></xsl:value-of>
</title>
<meta
charset=
"utf-8"
/>
<meta
name=
"author"
content=
""
/>
</xsl:template>
<!-- Default behavior for node -->
<xsl:template
match=
"node"
>
<xsl:element
name=
"section"
>
<xsl:element
name=
"section"
>
<header>
<h1>
<xsl:value-of
select=
"@TEXT"
/><xsl:value-of
select=
"richcontent"
></xsl:value-of>
<xsl:value-of
select=
"@TEXT"
/>
<xsl:value-of
select=
"richcontent"
/>
</h1>
</header>
<xsl:apply-templates
select=
"node"
/>
</xsl:element>
</xsl:template>
<!-- Behavior when node has no children -->
<xsl:template
match=
"node[not(node)]|node[contains(//@TEXT, '#p')]|node[contains(//@TEXT, '#a')]"
priority=
"1"
>
<xsl:element
name=
"section"
>
<xsl:template
match=
"node[not(node)]|node[contains(//@TEXT, '#p')]|node[contains(//@TEXT, '#a')]"
priority=
"1"
>
<xd:doc
xmlns:xd=
"http://www.oxygenxml.com/ns/doc/xsl"
>
<xd:desc>
<xd:p></xd:p>
</xd:desc>
</xd:doc>
<xsl:element
name=
"section"
>
<xsl:attribute
name=
"data-hdoc-type"
>
unit-of-content
</xsl:attribute>
<header>
<h1>
<xsl:value-of
select=
"@TEXT"
/><xsl:value-of
select=
"richcontent"
></xsl:value-of>
<xsl:value-of
select=
"@TEXT"
/>
<xsl:value-of
select=
"richcontent"
/>
</h1>
</header>
<!--<xsl:apply-templates/>-->
</xsl:element>
</xsl:template>
<xsl:template
match=
"node[contains(@TEXT, '#p')]"
priority=
"2"
>
<xsl:element
name=
"p"
>
<xsl:value-of
select=
"utc:string-remove-all(@TEXT, '#p ')"
></xsl:value-of
>
<xsl:value-of
select=
"utc:string-remove-all(@TEXT, '#p ')"
/
>
</xsl:element>
</xsl:template>
...
...
@@ -67,42 +75,42 @@
<xsl:element
name=
"a"
>
<xsl:attribute
name=
"href"
>
<xsl:text>
#
</xsl:text>
<xsl:value-of
select=
"utc:string-remove-all(@TEXT, '#a ')"
></xsl:value-of
>
<xsl:value-of
select=
"utc:string-remove-all(@TEXT, '#a ')"
/
>
</xsl:attribute>
<xsl:value-of
select=
"utc:string-remove-all(@TEXT, '#a ')"
></xsl:value-of
>
<xsl:value-of
select=
"utc:string-remove-all(@TEXT, '#a ')"
/
>
</xsl:element>
</xsl:template>
<xsl:template
match=
"richcontent"
>
<xsl:value-of
select=
"html/body/p"
/>
<xsl:value-of
select=
"html/body/p"
/>
</xsl:template>
<!-- Utility functions -->
<xsl:function
name=
"utc:string-remove-all"
as=
"xs:string"
>
<xsl:param
name=
"text"
as=
"xs:string"
/>
<xsl:param
name=
"replace"
as=
"xs:string"
/>
<xsl:param
name=
"replace"
as=
"xs:string"
/>
<!--
<xsl:call-template name="string-remove-all">
<xsl:with-param name="text" select="$text" />
<xsl:with-param name="replace" select="$replace" />
</xsl:call-template>-->
<xsl:value-of
select=
"$text"
></xsl:value-of
>
</xsl:function>
<xsl:value-of
select=
"$text"
/
>
</xsl:function>
<xsl:template
name=
"string-remove-all"
>
<xsl:param
name=
"text"
as=
"xs:string"
/>
<xsl:param
name=
"replace"
as=
"xs:string"
/>
<xsl:param
name=
"replace"
as=
"xs:string"
/>
<xsl:choose>
<xsl:when
test=
"contains($text, $replace)"
>
<xsl:value-of
select=
"substring-before($text,$replace)"
/>
<xsl:value-of
select=
"substring-before($text,$replace)"
/>
<xsl:call-template
name=
"string-remove-all"
>
<xsl:with-param
name=
"text"
select=
"substring-after($text,$replace)"
/>
<xsl:with-param
name=
"replace"
select=
"$replace"
/>
<xsl:with-param
name=
"text"
select=
"substring-after($text,$replace)"
/>
<xsl:with-param
name=
"replace"
select=
"$replace"
/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of
select=
"$text"
/>
<xsl:value-of
select=
"$text"
/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment