Skip to content

Commit

Permalink
0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
bahrus committed Apr 18, 2023
1 parent 6471d1e commit 98fa938
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
6 changes: 3 additions & 3 deletions tests/hemingway.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
Derive day of event as date from datetime attribute.
Itemize.
'>
<obj-ml >
<xsl:for-each select="//li">
<obj-ml>
<xsl:for-each select="div/ul/li">
<li-ml itemprop="product" product-id-n="{data/@value}" description="{data/text()}"></li-ml>
</xsl:for-each>
</obj-ml>
Expand All @@ -44,7 +44,7 @@
}
setTimeout(() => {
runTest();
}, 2000);
}, 1000);
</script>
<script type=importmap>
{
Expand Down
8 changes: 7 additions & 1 deletion xslt.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
export async function xslt(xsltProcessor, realmToSurvey, derivedVals) {
const xmlSrc = realmToSurvey.cloneNode(true);
let xmlSrc = realmToSurvey.cloneNode(true);
if (navigator.userAgent.indexOf("Firefox") !== -1) {
const outer = document.createElement('div');
outer.appendChild(xmlSrc);
xmlSrc = outer;
}
console.log(xmlSrc.outerHTML);
const { swap } = await import('trans-render/xslt/swap.js');
swap(xmlSrc, true);
const resultDocument = xsltProcessor.transformToFragment(xmlSrc, document);
Expand Down
11 changes: 8 additions & 3 deletions xslt.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
export async function xslt(xsltProcessor: XSLTProcessor, realmToSurvey: Element, derivedVals: any){
const xmlSrc = realmToSurvey.cloneNode(true) as Element;
let xmlSrc = realmToSurvey.cloneNode(true) as Element;
if(navigator.userAgent.indexOf("Firefox") !== -1){
const outer = document.createElement('div');
outer.appendChild(xmlSrc);
xmlSrc = outer;
}
console.log(xmlSrc.outerHTML);
const {swap} = await import('trans-render/xslt/swap.js');
swap(xmlSrc, true);
const resultDocument = xsltProcessor.transformToFragment(xmlSrc, document);
Expand All @@ -9,8 +15,7 @@ export async function xslt(xsltProcessor: XSLTProcessor, realmToSurvey: Element,
customElements.upgrade(resultDocument);
const val = resultDocument.querySelector('obj-ml')?.value;
Object.assign(derivedVals, val);



}

export function toCanonical(self: HTMLTemplateElement){
Expand Down

0 comments on commit 98fa938

Please sign in to comment.