SV: [jdom-interest] XSL and JDOM
Per Norrman
pernorrman at telia.com
Tue Feb 3 13:58:00 PST 2004
Hi,
The <lala> and <par> elements are not in the SMIL namespace, since the
parSector
template is not in the scope of the SMIL namespace declaration.
You have two options:
1) move the SMIL namespace declaration up to the root xsl:stylesheet
element. In this
case, every unprefixed element will belong to the SMIL namespace. Like
so:
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/2001/SMIL20/Language"
>
<xsl:output method="smil" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="presentation">
<smil>
<head>
or, 2) explicitly declare the SMIL namespace for <lala> and <par>:
<xsl:template name="parSector">
<lala xmlns="http://www.w3.org/2001/SMIL20/Language">
<xsl:value-of select="local-name(current())"/>
</lala>
<par xmlns="http://www.w3.org/2001/SMIL20/Language"
dur="indefinite"/>
</xsl:template>
</xsl:stylesheet>
The first option is probably the way to go.
/pmn
> -----Ursprungligt meddelande-----
> Från: jdom-interest-admin at jdom.org
> [mailto:jdom-interest-admin at jdom.org] För std00047 at di.uoa.gr
> Skickat: den 3 februari 2004 19:34
> Till: jdom-interest at jdom.org
> Ämne: [jdom-interest] XSL and JDOM
>
>
> Hello to everybody...
>
> I am a newbie to XSL and JDOM and I would like your help!
>
> I have a configuration file in XML describing the contents of
> a SMIL file. My
> aim is to write an XSL file to convert these data into a SMIL
> file, using JDOM
> (XSLTransform.java).
>
> The problem is the following:
>
> ====================================
> XML file
> ====================================
> <?xml version="1.0" encoding="UTF-8" ?>
> <presentation>
> <content />
> </presentation>
>
> ====================================
> XSL file
> ====================================
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="smil" omit-xml-declaration="yes"
> indent="yes"/>
>
> <xsl:template match="presentation">
> <smil xmlns="http://www.w3.org/2001/SMIL20/Language">
> <head>
> <layout>
> <root-layout width="700" height="550"
> backgroundColor="white"/>
> <region id="testregion"/>
> </layout>
> </head>
> <body>
> <excl dur="indefinite">
> <xsl:call-template name="parSector">
> <xsl:with-param
> name="parSec">1</xsl:with-param>
> </xsl:call-template>
> </excl>
> </body>
> </smil>
> </xsl:template>
>
> <xsl:template name="parSector">
> <lala><xsl:value-of select="local-name(current())"/></lala>
> <par dur="indefinite"/>
> </xsl:template>
> </xsl:stylesheet>
>
> ============================================
> SMIL file: result
> ============================================
> <?xml version="1.0" encoding="UTF-8"?>
> <smil xmlns="http://www.w3.org/2001/SMIL20/Language">
> <head>
> <layout>
> <root-layout backgroundColor="white" height="550" width="700" />
> <region id="testregion" />
> </layout>
> </head>
> <body>
> <excl dur="indefinite">
> <lala xmlns="">presentation</lala>
> <par xmlns="" dur="indefinite" />
> </excl>
> </body>
> </smil>
> ------------------------------------------------
>
> You may notice that in the result SMIL file, in the
> <body>
> <excl>
> <lala xmlns="">
> there is the attribute: xmlns="" , which is not acceptable
> for a SMIL file. I noticed that this appears when i
> <xsl:call-template>...
>
> Is there anything wrong in my code... I don't know
> I would be thankful if you could help me...
>
> -- George
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/yo
uraddr at yourhost.com
More information about the jdom-interest
mailing list