SGMLXML.net A place for SGML and XML application developers.

March 11, 2005

Date/Time Processing Package for XSLT

Filed under: XSLT — @ 1:56 pm







This module provides templates for formatting and parsing date/time strings:


http://xsltsl.sourceforge.net/date-time.html


 

Evaluating an XPATH expression using Epic Editor

Filed under: XSLT — @ 1:56 pm







To evaluate an xpath expression within Epic, open a document, position the cursor in the proper context, and type in the following function at the command line:


oid_xpath_string(oid, expr);


For Example:



eval oid_xpath_string(oid_caret(),”child::*[local-name()=’title’]”)

Example of XSLT document() function to create a lookup table

Filed under: XSLT — cangione @ 1:56 pm




 This technique can be used to add metadata to incoming source documents.< ?xml:namespace prefix = o />

 Source:

<![CDATA[

<?xml version=”1.0″ encoding=”UTF-8″?>

<mydoc>

            <title>Introduction</title>

            <title>Introduction2</title>

            <title>Bogus</title>

</mydoc>

]]>

 Stylesheet:

<![CDATA[

<?xml version=”1.0″ encoding=”UTF-8″?>

<xsl:transform   version=”1.0

                        xmlns:xsl=”http://www.w3.org/1999/XSL/Transform

                        xmlns:book=”books.uri

                        exclude-result-prefixes=”book“>

            <xsl:output method=”xml version=”1.0 encoding=”UTF-8 indent=”yes“/> 

<xsl:template match=”/“>

            <xsl:apply-templates/>

</xsl:template>

<xsl:template match=”mydoc“>

            <xsl:apply-templates/>

</xsl:template>           

<xsl:template match=”title“>

            <xsl:value-of select=”document(”)/*/book:category[@desc=current()]/@code“/>

</xsl:template>

<book:category code=”1 desc=”Introduction“/>

<book:category code=”1 desc=”Introduction2“/>

<book:category code=”2 desc=”Bogus“/> 

</xsl:transform>

]]>

 

 

« Newer Posts

Powered by WordPress