Skip to content

Commit afa019f

Browse files
committed
cont
Merge branch 'master' of https://github.com/lindenb/xslt-sandbox
2 parents e972208 + effcee8 commit afa019f

File tree

7 files changed

+270
-32
lines changed

7 files changed

+270
-32
lines changed

stylesheets/bio/gatk/jsonx2fxml.xsl

Lines changed: 94 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,58 @@
88
<xsl:output method="xml" indent="yes"/>
99

1010
<xsl:template match="/">
11+
12+
<xsl:processing-instruction name="import">javafx.scene.layout.*</xsl:processing-instruction>
13+
<xsl:processing-instruction name="import">javafx.scene.paint.*</xsl:processing-instruction>
14+
<xsl:processing-instruction name="import">javafx.scene.control.*</xsl:processing-instruction>
15+
<xsl:processing-instruction name="import">javafx.geometry.*</xsl:processing-instruction>
16+
<xsl:processing-instruction name="import">xx.CheckboxOpt</xsl:processing-instruction>
17+
<VBox>
18+
<MenuBar>
19+
<Menu text="File">
20+
<MenuItem text="Quit" />
21+
</Menu>
22+
</MenuBar>
23+
<TabPane>
24+
25+
<Tab>
26+
<xsl:attribute name="text">
27+
<xsl:value-of select="/j:object/j:string[@name='name']"/>
28+
</xsl:attribute>
29+
<ScrollPane>
30+
<VBox alignment="CENTER_RIGHT" style="-fx-padding: 15px;">
1131
<xsl:apply-templates select="/j:object/j:array[@name='arguments']/j:object"/>
32+
</VBox>
33+
</ScrollPane>
34+
</Tab>
35+
36+
<Tab text="Reference" >
37+
</Tab>
38+
39+
</TabPane>
40+
</VBox>
1241
</xsl:template>
1342

14-
<xsl:template match="j:object[j:string[@name='type'] = 'Boolean']">
43+
<xsl:template match="j:object[j:string[@name='type'] = 'Boolean' or j:string[@name='type'] = 'boolean'] ">
1544
<xsl:text>
1645

1746
</xsl:text>
18-
<fx:root type="javafx.scene.layout.HBox" xmlns:fx="http://javafx.com/fxml">
19-
<TextField editable="false" fx:id="textField" />
20-
<Checbox text="Select..." onAction="#doSelectFile">
21-
<xsl:attribute name="text">
22-
<xsl:value-of select="j:string[@name='summary']"/>
23-
</xsl:attribute>
24-
</Checbox>
25-
26-
<Button text="&#x232b;" onAction="#doClear" >
27-
<tooltip>
28-
<Tooltip text="Remove File" />
29-
</tooltip>
30-
</Button>
31-
</fx:root>
47+
<BorderPane style="-fx-padding: 5 5 5 5;">
48+
49+
<center>
50+
<FlowPane style="-fx-padding: 5 0 5 0;">
51+
<CheckBox style="-fx-font-weight:bold;" BorderPane.alignment="CENTER_LEFT" >
52+
<xsl:apply-templates select="." mode="variable"/>
53+
<xsl:attribute name="text">
54+
<xsl:value-of select="j:string[@name='summary']"/>
55+
</xsl:attribute>
56+
<xsl:apply-templates select="." mode="tooltip"/>
57+
58+
</CheckBox>
59+
</FlowPane>
60+
</center>
61+
</BorderPane>
62+
<Separator/>
3263
<xsl:text>
3364

3465
</xsl:text>
@@ -38,22 +69,57 @@
3869
<xsl:text>
3970

4071
</xsl:text>
41-
<fx:root type="javafx.scene.layout.HBox" xmlns:fx="http://javafx.com/fxml">
42-
<TextField editable="false" fx:id="textField" />
43-
<Button text="Select..." onAction="#doSelectFile">
44-
<tooltip>
45-
<Tooltip text="Select File... " />
46-
</tooltip>
47-
</Button>
48-
<Button text="&#x232b;" onAction="#doClear" >
49-
<tooltip>
50-
<Tooltip text="Remove File" />
51-
</tooltip>
52-
</Button>
53-
</fx:root>
72+
<BorderPane style="-fx-padding: 5 5 5 5;">
73+
<xsl:apply-templates select="." mode="summary"/>
74+
<center>
75+
<FlowPane style="-fx-padding: 5 0 5 20;">
76+
<TextField prefColumnCount="50">
77+
<xsl:apply-templates select="." mode="variable"/>
78+
<xsl:attribute name="promptText">
79+
<xsl:value-of select="j:string[@name='summary']"/>
80+
</xsl:attribute>
81+
</TextField>
82+
</FlowPane>
83+
</center>
84+
<bottom>
85+
<CheckboxOpt/>
86+
</bottom>
87+
</BorderPane>
88+
<Separator/>
5489
<xsl:text>
5590

5691
</xsl:text>
5792
</xsl:template>
5893

94+
95+
<xsl:template match="j:object" mode="variable">
96+
<xsl:attribute name="id">
97+
<xsl:value-of select="substring(j:string[@name='name'],3)"/>
98+
</xsl:attribute>
99+
<xsl:attribute name="fx:id">
100+
<xsl:value-of select="substring(j:string[@name='name'],3)"/>
101+
</xsl:attribute>
102+
</xsl:template>
103+
104+
<xsl:template match="j:object" mode="summary">
105+
<top>
106+
<Label style="-fx-font-weight:bold;">
107+
<xsl:attribute name="text">
108+
<xsl:value-of select="j:string[@name='summary']"/>
109+
</xsl:attribute>
110+
<xsl:apply-templates select="." mode="tooltip"/>
111+
</Label>
112+
</top>
113+
</xsl:template>
114+
115+
<xsl:template match="j:object" mode="tooltip">
116+
<tooltip>
117+
<Tooltip>
118+
<xsl:attribute name="text">
119+
<xsl:value-of select="j:string[@name='fulltext']"/>
120+
</xsl:attribute>
121+
</Tooltip>
122+
</tooltip>
123+
</xsl:template>
124+
59125
</xsl:stylesheet>
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xsl:stylesheet
3+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4+
xmlns:j="http://www.ibm.com/xmlns/prod/2009/jsonx"
5+
xmlns:fx="http://javafx.com/fxml"
6+
version="1.0"
7+
>
8+
<xsl:output method="text" indent="yes"/>
9+
10+
<xsl:template match="/">
11+
<xsl:variable name="engine" select="/j:object/j:string[@name='name']"/>
12+
13+
import javafx.application.Application;
14+
import javafx.application.Platform;
15+
import javafx.event.ActionEvent;
16+
import javafx.event.EventHandler;
17+
import javafx.scene.Scene;
18+
import javafx.scene.control.Button;
19+
import javafx.scene.layout.*;
20+
import javafx.stage.Stage;
21+
import java.util.ResourceBundle;
22+
import javafx.fxml.*;
23+
import javafx.fxml.Initializable;
24+
import javafx.scene.control.*;
25+
import javafx.scene.*;
26+
import javafx.geometry.Rectangle2D;
27+
import javafx.stage.Screen;
28+
29+
public class <xsl:value-of select="$engine"/>
30+
extends Application
31+
{
32+
public <xsl:value-of select="$engine"/>()
33+
{
34+
35+
}
36+
37+
@Override
38+
public void start(Stage stage) throws Exception {
39+
final Parent root;
40+
41+
try
42+
{
43+
root = FXMLLoader.load( getClass().getResource("<xsl:value-of select="$engine"/>.fxml"));
44+
}
45+
catch(Exception err)
46+
{
47+
err.printStackTrace();
48+
throw err;
49+
}
50+
51+
xx.CheckboxOpt x=null;
52+
53+
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
54+
Scene scene = new Scene(root);
55+
56+
stage.setTitle("<xsl:value-of select="$engine"/>");
57+
stage.setScene(scene);
58+
59+
stage.setX(50);
60+
stage.setY(50);
61+
stage.setWidth(primaryScreenBounds.getWidth()-100);
62+
stage.setHeight(primaryScreenBounds.getHeight()-100);
63+
stage.show();
64+
}
65+
66+
@FXML
67+
private void doMenuQuit(final ActionEvent event)
68+
{
69+
Platform.exit();
70+
}
71+
72+
public static void main(String[] args) {
73+
launch( <xsl:value-of select="$engine"/>.class,args);
74+
}
75+
76+
<xsl:apply-templates select="/j:object/j:array[@name='arguments']/j:object"/>
77+
78+
}
79+
80+
</xsl:template>
81+
82+
<xsl:template match="j:object[j:string[@name='type'] = 'Boolean' or j:string[@name='type'] = 'boolean']">
83+
@FXML
84+
<xsl:apply-templates select="." mode="GATK"/>
85+
private CheckBox <xsl:apply-templates select="." mode="variable"/>;
86+
</xsl:template>
87+
88+
<xsl:template match="j:object">
89+
@FXML
90+
<xsl:apply-templates select="." mode="GATK"/>
91+
private TextField <xsl:apply-templates select="." mode="variable"/>;
92+
<xsl:text>
93+
94+
</xsl:text>
95+
</xsl:template>
96+
97+
98+
<xsl:template match="j:object" mode="variable">
99+
<xsl:value-of select="substring(j:string[@name='name'],3)"/>
100+
</xsl:template>
101+
102+
<xsl:template match="j:object" mode="GATK">
103+
@GATK(param="<xsl:value-of select="j:string[@name='name']"/>",type="<xsl:value-of select="j:string[@name='type']"/>")
104+
</xsl:template>
105+
106+
</xsl:stylesheet>

stylesheets/github/github2html.xsl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,17 @@ Example: curl -s "https://github.com/lindenb/jvarkit/wiki/SamJS" | xsltproc -\-
210210

211211

212212
<xsl:template match="a[@href]">
213+
<xsl:choose>
214+
<xsl:when test="starts-with(@href,'#') or string-length(normalize-space(.)) = 0">
215+
<xsl:apply-templates/>
216+
</xsl:when>
217+
<xsl:otherwise>
213218
<a>
214219
<xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute>
215220
<xsl:apply-templates/>
216221
</a>
222+
</xsl:otherwise>
223+
</xsl:choose>
217224
</xsl:template>
218225

219226

stylesheets/instagram/instagram2html.xsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
<xsl:text> by </xsl:text>
3535
<xsl:element name="a">
3636
<xsl:attribute name="href">
37-
<xsl:value-of select="concat('https://www.instagram.com/',substring-before(head/meta[@property='og:title']/@content,' '),'/')"/>
37+
<xsl:value-of select="concat('https://www.instagram.com/',substring-before(substring-after(head/meta[@name='description']/@content,'by @'),' '),'/')"/>
3838
</xsl:attribute>
39-
<xsl:value-of select="concat('@',substring-before(head/meta[@property='og:title']/@content,' '))"/>
39+
<xsl:value-of select="concat('@',substring-before(substring-after(head/meta[@name='description']/@content,'by @'),' '))"/>
4040
</xsl:element>
4141
<xsl:text>. </xsl:text>
4242
<xsl:value-of select="$today"/>

stylesheets/reddit/rgd.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
My drawing PASTEURL
3131

32-
[TB](http://tyeul.tumblr.com/)|[DA](http://yokofakun.deviantart.com/)|[FB](https://www.facebook.com/kakaheska)|[FL](https://www.flickr.com/photos/lindenb/)|[PT](http://www.pinterest.com/yokofakun/drawings/)|[IS](https://www.instagram.com/yokofakun/)
32+
[IG](https://www.instagram.com/yokofakun/)|[TU](http://tyeul.tumblr.com/)|[DA](http://yokofakun.deviantart.com/)|[FB](https://www.facebook.com/kakaheska)|[PT](http://www.pinterest.com/yokofakun/drawings/)
3333

3434
</xsl:text>
3535

stylesheets/rss/atom2html.xsl

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version='1.0' encoding="ISO-8859-1"?>
2+
<xsl:stylesheet
3+
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
4+
xmlns:media="http://search.yahoo.com/mrss/"
5+
xmlns:atom="http://www.w3.org/2005/Atom"
6+
xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
7+
exclude-result-prefixes="creativeCommons atom media"
8+
version='1.1'
9+
>
10+
<xsl:output method="xml" indent="yes"/>
11+
12+
13+
<xsl:template match="/">
14+
<html>
15+
<head>
16+
<title>Atom merger</title>
17+
</head>
18+
<body>
19+
<xsl:apply-templates select="atom:feed"/>
20+
</body>
21+
</html>
22+
</xsl:template>
23+
24+
<xsl:template match="atom:feed">
25+
<dl>
26+
<xsl:apply-templates select="atom:entry"/>
27+
</dl>
28+
</xsl:template>
29+
30+
31+
32+
33+
34+
<xsl:template match="atom:entry">
35+
<dt>
36+
<a>
37+
<xsl:attribute name="href">
38+
<xsl:value-of select="atom:link/@href"/>
39+
</xsl:attribute>
40+
<xsl:value-of select="atom:title/text()"/>
41+
</a>
42+
</dt>
43+
<dd>
44+
<xsl:choose>
45+
<xsl:when test="atom:content/@type='html'">
46+
<xsl:value-of select="atom:content" disable-output-escaping="yes"/>
47+
</xsl:when>
48+
<xsl:choose>
49+
<xsl:value-of select="atom:content"/>
50+
</xsl:choose>
51+
</xsl:choose>
52+
</dd>
53+
</xsl:template>
54+
55+
56+
57+
</xsl:stylesheet>

stylesheets/util/mod.drawing.xsl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727

2828
<xsl:template name="my-links">
2929
<div>
30+
<a href="https://www.instagram.com/yokofakun/">Instagram</a>
31+
<xsl:text> </xsl:text>
3032
<a href="http://tyeul.tumblr.com/">Tumblr</a>
3133
<xsl:text> </xsl:text>
3234
<a href="http://yokofakun.deviantart.com/">DeviantArt</a>
@@ -40,6 +42,6 @@
4042
</xsl:template>
4143

4244

43-
<xsl:variable name="commontags">drawing sketch illustration gimp onedrawingaday portrait dessin femme fille art retrato face visage artwork draw sketchaday dailydrawing sketch_daily<xsl:if test="number(x:month-in-year())=10"> inktober</xsl:if></xsl:variable>
45+
<xsl:variable name="commontags">drawing sketch illustration gimp onedrawingaday portrait dessin femme fille art retrato face visage artwork draw sketchaday dailydrawing sketch_daily<xsl:if test="number(x:month-in-year())=10"> inktober inktober<xsl:value-of select="x:year()"/></xsl:if></xsl:variable>
4446

4547
</xsl:stylesheet>

0 commit comments

Comments
 (0)