SlideShare una empresa de Scribd logo
1 de 21
in 37 minutes Episode 18 What WILL my output look like? Customizing XMetaL’s Page Preview Tom Magliery, XML Technology Specialist Brought to you by XMetaL Technical Services
Announcements XMetaL Author 6.0 SP1 TopLeaf plug-in
Demo 0: baseline Look at the default HTML preview Demo 1: low-hanging fruit Replacing the default HTML transformation Demo 2: user control Making a user macro to generate the preview Demo 3: PDF, too Doing the above stuff with PDF Demo 4: HTML  PDF Changing the “default” mode for page preview Demo 5: non-XSLT Using script instead of XSLT for the transformation  Agenda
XMetaL automatically generates a preview It approximates thein-editor CSS styles The code for this is in $XMDIRuthortartupultipleOutput.mcr Demo 0: baseline
On_Before_Document_Preview macro Verifies and/or regenerates XSLT Transform uses three XSLT files: Auto-generated XSLT (based on CSS styles) Your custom XSLT (if it exists) A “master” file that imports these other two Runs XSLT and saves output to temp file Sets ActiveDocument.BrowserURL property This tells XMetaL what page to send to the browser upon entering Page Preview The good news: the process for much of the above is encapsulated and accessible How it works
Add a custom style sheet It’s as easy as 0-1-2: 0.	Create an XSLT style sheet Give it the correct filename Put it in the correct place Note: Step 0 is outside the scope of this webinar!* Demo 1: low-hanging fruitReplacing the default HTML transformation * Many folks would also say Step 0 is not easy
If your DTD or schema name is “foo” ... ... then your style sheet must have this name: foo_HTML_Custom.xsl Our sample DTD is called “simplepaper”, hence: simplepaper_HTML_Custom.xsl Step 1: What to name it
If limited-user restrictions are enabled (as they are by default): 	%APPDATA%oftQuadMetaL.0isplaybr />For example, right now mine is here: 	C:ocuments and Settingsmaglierypplication DataoftQuadMetaL.0isplaybr />If limited-user restrictions are disabled: 	C:rogram FilesMetaL 6.0uthorisplaybr />If you see these other two files here, remove them now (they will need to be re-auto-generated): 	foo_HTML.xsl 	foo_HTML_Style.xsl Step 2: Where to put it* * In the folder where XMetaL is going to look for it, of course
“Helper” scriptfunctions defined in multipleOutput.mcr Call the helper functions in user macros Add this macro to your document MCR file Demo 2: user control Making a user macro to generate the preview <MACRO name="Do my HTML preview" lang="JScript" hide="false"><![CDATA[ previewHTML(); ]]></MACRO>
previewHTML() previewPDF() saveAsHTML() saveAsPDF() XMLtoHTMLSetup() XMLtoPDFSetup() Helper functions available
Architecture is similar to HTML On_Before_Document_Preview macro Verify and regenerate XSLT Run XSLT transform saving output to temp file Set the Application.BrowserURL property Add another macro for previewing PDF Demo 3: PDF, too Doing the above stuff with PDF <MACRO name="Do my PDF preview" lang="JScript" hide="false"><![CDATA[ previewPDF(); ]]></MACRO>
Custom style sheet file is: simplepaper_Custom.xsl Same directory as the HTML style sheets C:ocuments and Settingsmaglierypplication DataoftQuadMetaL.0isplaybr />Custom XSLT for PDF
XMetaL remembers a “preview mode” setting for each open document Global array (hash) aMOFormat defined in 	multipleOutput.mcr Make user macros that set array entry to “HTML” or “PDF” for current document Subsequently Page Preview will use that format Demo 4: HTML  PDFChanging the “default” mode for page preview <MACRO name="_Set Preview Mode to PDF" lang="JScript" hide="false"><![CDATA[ aMOFormat[ActiveDocument.FullName + "|"       + ActiveDocument.Title] = "PDF"; ]]></MACRO>
The code samples in this webinar have been tested with XMetaL Author 6.0.1.030. Unfortunately, I know there were some changes to multipleOutput.mcr in this version of XMetaL, which means some of my sample code may not work with other versions. This concludes the “working with XSLT” portion of the webinar. Special note
But I don’t wanna use XSLT!!
Demo 5: non-XSLTUsing script instead of XSLT for the transformation  XSLT is not the only way to generate output from XML Make your own On_Before_Document_Preview in document-level MCR file This macro will “win” over the one in multipleOutput.mcr Do whatever scripting you want to perform the transformation One possibility:   Invent a new “preview mode” such as “MyHTML” Follow the general pattern used by the OBDP in multipleOutput.mcr
Adding a new “preview mode” to OBDP //Pseudocode/algorithm from existing OBDP: If MOFormat is "HTML" 	XSLT transform with HTML output 	Set the "BrowserURL" property Else if MOFormat is "PDF" 	XSLT transform with PDF output 	Set the "BrowserURL" property //new for this example: Else if MOFormat is "MyHTML" 	Custom script to make HTML output 	Set the "BrowserURL" property
Pick out some bits and pieces: Logic for demo HTML output varhtmlStr = "<html><body>"; 	// pick out and use the main title of the paper varndlist = ActiveDocument.getNodesByXPath("Paper/Title"); htmlStr += "<h1>" + ndlist.item(0).firstChild.nodeValue + "</h1>"; 	// do some processing for each one of the sections var sections = ActiveDocument.getNodesByXPath("Paper/Section"); 	for (vari=0; i<sections.length; i++) 	{ var sect = sections.item(i); 		// pick out and use the section title varsecttitle = sect.getNodesByXPath("Title"); htmlStr += "<h2>" + secttitle.item(0).firstChild.nodeValue + "</h2>"; 		// do some processing for each of the paragraphs in this section var paragraphs = sect.getNodesByXPath("Para"); 		for (var j=0; j<paragraphs.length; j++) 		{ varpara_node = paragraphs.item(i); htmlStr += "<p>" + para_node.firstChild.nodeValue + "</p>"; 		} 	} htmlStr += "</body></html>";
We have seen how to: Customize the default page-preview XSLT Make user macros to generate HTML and PDF previews Change and manage the page-preview output type Use custom script instead of XSLT for the preview transformation  Whew! Summary
XMetaL Community Forums http://forums.xmetal.com/ JustSystems Partner Center http://justpartnercenter.com/ Ask us for help (partner tech support) partnersupport-na@justsystems.com Resources
Thank you for attending! Q&A

Más contenido relacionado

Último

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 

Último (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

Destacado

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Destacado (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Customizing XMetaL Page Preview

  • 1. in 37 minutes Episode 18 What WILL my output look like? Customizing XMetaL’s Page Preview Tom Magliery, XML Technology Specialist Brought to you by XMetaL Technical Services
  • 2. Announcements XMetaL Author 6.0 SP1 TopLeaf plug-in
  • 3. Demo 0: baseline Look at the default HTML preview Demo 1: low-hanging fruit Replacing the default HTML transformation Demo 2: user control Making a user macro to generate the preview Demo 3: PDF, too Doing the above stuff with PDF Demo 4: HTML  PDF Changing the “default” mode for page preview Demo 5: non-XSLT Using script instead of XSLT for the transformation Agenda
  • 4. XMetaL automatically generates a preview It approximates thein-editor CSS styles The code for this is in $XMDIRuthortartupultipleOutput.mcr Demo 0: baseline
  • 5. On_Before_Document_Preview macro Verifies and/or regenerates XSLT Transform uses three XSLT files: Auto-generated XSLT (based on CSS styles) Your custom XSLT (if it exists) A “master” file that imports these other two Runs XSLT and saves output to temp file Sets ActiveDocument.BrowserURL property This tells XMetaL what page to send to the browser upon entering Page Preview The good news: the process for much of the above is encapsulated and accessible How it works
  • 6. Add a custom style sheet It’s as easy as 0-1-2: 0. Create an XSLT style sheet Give it the correct filename Put it in the correct place Note: Step 0 is outside the scope of this webinar!* Demo 1: low-hanging fruitReplacing the default HTML transformation * Many folks would also say Step 0 is not easy
  • 7. If your DTD or schema name is “foo” ... ... then your style sheet must have this name: foo_HTML_Custom.xsl Our sample DTD is called “simplepaper”, hence: simplepaper_HTML_Custom.xsl Step 1: What to name it
  • 8. If limited-user restrictions are enabled (as they are by default): %APPDATA%oftQuadMetaL.0isplaybr />For example, right now mine is here: C:ocuments and Settingsmaglierypplication DataoftQuadMetaL.0isplaybr />If limited-user restrictions are disabled: C:rogram FilesMetaL 6.0uthorisplaybr />If you see these other two files here, remove them now (they will need to be re-auto-generated): foo_HTML.xsl foo_HTML_Style.xsl Step 2: Where to put it* * In the folder where XMetaL is going to look for it, of course
  • 9. “Helper” scriptfunctions defined in multipleOutput.mcr Call the helper functions in user macros Add this macro to your document MCR file Demo 2: user control Making a user macro to generate the preview <MACRO name="Do my HTML preview" lang="JScript" hide="false"><![CDATA[ previewHTML(); ]]></MACRO>
  • 10. previewHTML() previewPDF() saveAsHTML() saveAsPDF() XMLtoHTMLSetup() XMLtoPDFSetup() Helper functions available
  • 11. Architecture is similar to HTML On_Before_Document_Preview macro Verify and regenerate XSLT Run XSLT transform saving output to temp file Set the Application.BrowserURL property Add another macro for previewing PDF Demo 3: PDF, too Doing the above stuff with PDF <MACRO name="Do my PDF preview" lang="JScript" hide="false"><![CDATA[ previewPDF(); ]]></MACRO>
  • 12. Custom style sheet file is: simplepaper_Custom.xsl Same directory as the HTML style sheets C:ocuments and Settingsmaglierypplication DataoftQuadMetaL.0isplaybr />Custom XSLT for PDF
  • 13. XMetaL remembers a “preview mode” setting for each open document Global array (hash) aMOFormat defined in multipleOutput.mcr Make user macros that set array entry to “HTML” or “PDF” for current document Subsequently Page Preview will use that format Demo 4: HTML  PDFChanging the “default” mode for page preview <MACRO name="_Set Preview Mode to PDF" lang="JScript" hide="false"><![CDATA[ aMOFormat[ActiveDocument.FullName + "|" + ActiveDocument.Title] = "PDF"; ]]></MACRO>
  • 14. The code samples in this webinar have been tested with XMetaL Author 6.0.1.030. Unfortunately, I know there were some changes to multipleOutput.mcr in this version of XMetaL, which means some of my sample code may not work with other versions. This concludes the “working with XSLT” portion of the webinar. Special note
  • 15. But I don’t wanna use XSLT!!
  • 16. Demo 5: non-XSLTUsing script instead of XSLT for the transformation XSLT is not the only way to generate output from XML Make your own On_Before_Document_Preview in document-level MCR file This macro will “win” over the one in multipleOutput.mcr Do whatever scripting you want to perform the transformation One possibility: Invent a new “preview mode” such as “MyHTML” Follow the general pattern used by the OBDP in multipleOutput.mcr
  • 17. Adding a new “preview mode” to OBDP //Pseudocode/algorithm from existing OBDP: If MOFormat is "HTML" XSLT transform with HTML output Set the "BrowserURL" property Else if MOFormat is "PDF" XSLT transform with PDF output Set the "BrowserURL" property //new for this example: Else if MOFormat is "MyHTML" Custom script to make HTML output Set the "BrowserURL" property
  • 18. Pick out some bits and pieces: Logic for demo HTML output varhtmlStr = "<html><body>"; // pick out and use the main title of the paper varndlist = ActiveDocument.getNodesByXPath("Paper/Title"); htmlStr += "<h1>" + ndlist.item(0).firstChild.nodeValue + "</h1>"; // do some processing for each one of the sections var sections = ActiveDocument.getNodesByXPath("Paper/Section"); for (vari=0; i<sections.length; i++) { var sect = sections.item(i); // pick out and use the section title varsecttitle = sect.getNodesByXPath("Title"); htmlStr += "<h2>" + secttitle.item(0).firstChild.nodeValue + "</h2>"; // do some processing for each of the paragraphs in this section var paragraphs = sect.getNodesByXPath("Para"); for (var j=0; j<paragraphs.length; j++) { varpara_node = paragraphs.item(i); htmlStr += "<p>" + para_node.firstChild.nodeValue + "</p>"; } } htmlStr += "</body></html>";
  • 19. We have seen how to: Customize the default page-preview XSLT Make user macros to generate HTML and PDF previews Change and manage the page-preview output type Use custom script instead of XSLT for the preview transformation Whew! Summary
  • 20. XMetaL Community Forums http://forums.xmetal.com/ JustSystems Partner Center http://justpartnercenter.com/ Ask us for help (partner tech support) partnersupport-na@justsystems.com Resources
  • 21. Thank you for attending! Q&A